Articles → .NET → Cross Page Postback In ASP.NET
Cross Page Postback In ASP.NET
Implementation
- First of all create 2 webforms one will be source and other will be destination.
- In the source page add a textbox and a button as shown in following code
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Button runat="server" Text="Navigate to other page" PostBackUrl="~/cross_page_post_back_destination.aspx" />
- On the destination page add following code in code behind.
protected void Page_Load(object sender, EventArgs e) {
TextBox txtName = (TextBox) PreviousPage.FindControl("txtName");
Response.Write(txtName.Text);
}
Output
Posted By - | Karan Gupta |
|
Posted On - | Wednesday, April 21, 2010 |
|
Updated On - | Saturday, May 16, 2015 |