首页 > IT职业 > IT生活 > 使用PreviousPage获取源页信息
下面这个例子是演示在MasterPage母板下面。例子始起页放一个TextBox和一个Button,并用PostBackUrl来导向目标页。如:

在目标页的Page_Load可以写接收数据,把接收到的值显示在Label上:

{
if (PreviousPage != null)
{
ContentPlaceHolder cph = (ContentPlaceHolder)PreviousPage.Master.FindControl("ContentPlaceHolder1");
Label1.Text = ((TextBox)cph.FindControl("TextBox1")).Text;
}
}
更多相关资讯,可以参考Microsoft MSDN: http://msdn.microsoft.com/zh-cn/library/ms178139.aspx
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3127/viewspace-2811788/ ,如需转载,请注明出处,否则将追究法律责任。