欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net 頁面間傳值與跳轉(zhuǎn)的區(qū)別

 更新時(shí)間:2010年04月07日 15:15:53   作者:  
通過Server.Transfer("b.aspx") 與Response.Redirect("b.aspx")的區(qū)別
在a.aspx跳轉(zhuǎn)到b.aspx
通過Server.Transfer("b.aspx") 與Response.Redirect("b.aspx")的區(qū)別
如果是通過通過Server.Transfer()在a.aspx跳轉(zhuǎn)到b.aspx的,則在b.aspx頁面,可以查找到保存在a.aspx頁面中的 控件中的值,如果是Response.Redirect(),則得不到到a.aspx頁面中控件的值。
如果是通過Server.Transfer("b.aspx"),則可以通知以下方式得到 保留在 a.aspx中例如 Label,HiddenField中的值
復(fù)制代碼 代碼如下:

HiddenField hfOrderID = new HiddenField();
HiddenField hfPayMoney = new HiddenField();
if (Page.PreviousPage != null)
{
try
{  
    //
//查找母版頁 ,
MasterPage masterPage = (MasterPage)Page.PreviousPage.Controls[0];
//
//查找容器
ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)masterPage.FindControl("ContentPlaceHolder3");
System.Web.UI.UserControl userControl = (System.Web.UI.UserControl)contentPlaceHolder.FindControl("MyOrder1");
//
//查找到對(duì)應(yīng)的數(shù)據(jù)傳送HiddenField
hfOrderID = (HiddenField)userControl.FindControl("hfOrderID");
hfPayMoney = (HiddenField)userControl.FindControl("hfPayMoney");
    //
//獲取傳入的訂單號(hào)
string strOrderID = hfOrderID.Value;
string strPayMoney = hfPayMoney.value;
  }
}

相關(guān)文章

最新評(píng)論