This article describes how to use different methods to implement ASP. NET page value transfer, the three methods are: QueryString, Session and Server. transfer, we should repeat the similarities and differences between several methods. I hope this article will be helpful to you until you can use it in your code!
Method 1:
Pass through URL link address
Send. aspx:
Protected void button#click (object sender, EventArgs e)
{
Request. Redirect ("Default2.aspx? Username = honge ");
}
Receive. aspx:
String username = Request. QueryString ["username"]; To obtain the parameter value.
Method 2:
Post.
Send. aspx
<Form id = "form1" runat = "server" action = "receive. aspx" method = post>
<Div>
<Asp: Button ID = "Button1" runat = "server" OnClick = "button#click" Text = "Button"/>
<Asp: TextBox ID = "username" runat = "server"> </asp: TextBox>
</Div>
</Form>
Receive. aspx
String username = Ruquest. Form ["receive"];
- Four pages in total:
- Previous Page
- 1
- 2
- 3
- 4
- Next Page