The first method:
Pass through URL link address
Send.aspx:
Copy Code code as follows:
protected void Button1_Click (object sender, EventArgs e)
{
Request.redirect ("Default2.aspx?username=honge");
}
Receive.aspx:
Copy Code code as follows:
String username = request.querystring["username"] so that the parameter values can be obtained.
The second method:
Send.aspx
Copy Code code as follows:
<form id= "Form1" runat= "Server" action= "receive.aspx" method=post>
<div>
<asp:button id= "Button1" runat= "Server" onclick= "Button1_Click" text= "button"/>
<asp:textbox id= "username" runat= "server" ></asp:TextBox>
</div>
</form>
Receive.aspx
Copy Code code as follows:
String username = ruquest.form["Receive"];
The third method:
Send.aspx:
Copy Code code as follows:
protected void Button1_Click (object sender, EventArgs e)
{
session["username"] = "Honge";
Request.redirect ("default2.aspx");
}
\receive.aspx:
Copy Code code as follows:
String username = session["username"] so that the parameter values can be obtained.
The Fourth method:
Send.aspx:
Copy Code code as follows:
protected void Button1_Click (object sender, EventArgs e)
{
application["username"] = "Honge";
Request.redirect ("default2.aspx");
}
Receive.aspx:
Copy Code code as follows:
String username = application["username"] so that the parameter values can be obtained.
The Fifth method:
Send.aspx:
Copy Code code as follows:
public string Name
{
get {
return "Honge";
}
}
protected void Button1_Click (object sender, EventArgs e)
{
Server.Transfer ("default2.aspx");
}
Receive.aspx:
Copy Code code as follows:
Send d = context.handler as send;
if (d!= null)
{
Response.Write (D.name) so that the parameter values can be obtained.
}
If you can also use this in asp.net 2.0:
Copy Code code as follows:
PreviousPage d = Context.Handler as previouspage;
if (d!= null)
{
Response.Write (D.name) so that the parameter values can be obtained.
}
You can also use this:
Send.aspx:
Copy Code code as follows:
<asp:button id= "btnsubmit" runat= "Server" postbackurl= "~/reveive.aspx" text= "Submit"/>
Receive.aspx:
Copy Code code as follows:
<%@ previouspagetype virtualpath= "~/default.aspx"%>
String name = Previouspage.name, so you can get parameter values.
add: In data-bound controls such as DataList or Repeater controls
<a href= "Article.aspx? id=<% #DataBinder. Eval (Container.DataItem, "article_id")%> "target=" _blank ">//" go to the link page and Id,id as a field in the database;