跨页数据传递

目前PostBackUrl属性的控件只有Botton、LinkBotton、ImageBotton三种,所以要实现跨页传递,一定要使用这三种按钮才行。这里我们使用Botton控件,并设置其PostBackUrl的属性为Target.aspx。

源页面上处理代码:

If(Page.IsCrossPagePostBack) //判断页面是否使用跨页提交

{

         This.txtkeyword.text=”跨页数据传送!”;

}

目标页面上处理代码:

If(page.PreviousPage!=null)

{

         If(PreviousPage.IsCrossPagePostBack)

   {

           This.lblShowURL.text=”您的查询条件为:" ((TextBox)this.PreviousPage.FindControl(“txtkeyword”)).text;

   }

}

原文地址:https://www.cnblogs.com/zhengguangITelite/p/2352421.html