c# web编程 c#入门经典的题解

c#web编程 c#入门经典的例题using Systemusing System.Collections.Genericusing System.Linqusing Sys

c# web编程 c#入门经典的例题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

  public partial class ResultPage : System.Web.UI.Page
  {
  protected void Page_Load(object sender, EventArgs e)
  {

  try
  {
  DropDownList dropDownListEvents = (DropDownList)PreviousPage.FindControl("dropDownList1");
  string selectedEvent = dropDownListEvents.SelectedValue;
  string firstname = ((TextBox)PreviousPage.FindControl("firstName")).Text;
  string lastname = ((TextBox)PreviousPage.FindControl("lastName")).Text;
  string email = ((TextBox)PreviousPage.FindControl("email")).Text;
  LabelResult.Text = firstname + " " + lastname + " select the event " + selectedEvent;
  }
  catch
  {
  LabelResult.Text = " The originating page must contain firstname,lastname,email";
  }


   
  }
}
原意是将输入的文本在另一个页面中显示,
但是PreviousPage出现异常,System.InvalidOperationException
不能显示文本内容

[解决办法]
楼主 你发错地方了
[解决办法]
wrong place!!