首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

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

2012-09-17 
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!!

热点排行