在ASP.NET中实现页面之间的传参的方法
三种方法:QueryString,Session,Server.Transfer
WebForm1.aspx
publicstringname
{
get
{
returntxtName.Text;
}
}
privatevoidbtnSubmit_Click(objectsender,System.EventArgse)
{
Server.Transfer("WebForm2.aspx");
}
{
get
{
returntxtName.Text;
}
}
privatevoidbtnSubmit_Click(objectsender,System.EventArgse)
{
Server.Transfer("WebForm2.aspx");
}
WebForm2.aspx
privatevoidPage_Load(objectsender,System.EventArgse)
{
WebForm1webForm1;
webForm1=(WebForm1)Context.Handler;
Response.Write(webForm1.name);
}
{
WebForm1webForm1;
webForm1=(WebForm1)Context.Handler;
Response.Write(webForm1.name);
}
本文地址:http://www.45fan.com/dnjc/70960.html