We have a lot of State Management techniques.
Use any of Client Side/Server Side State Management techniques to achieve your goal.
Here is the Code to Work with Cross Page postback:
The Following is the Code for Form1:
Here I'm using a LinkButton to go to 2nd Form.
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/CrossPagePostback_Form2.aspx">Go To Form2</asp:LinkButton>
<br />
<br />
<asp:TextBox ID="txtTest" runat="server"></asp:TextBox>
Now in 2nd Form I'm just using a Label to Show the Value of TextBox present in 1st Form:
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
TextBox txtTest = (TextBox)PreviousPage.FindControl("txtTest");
Label1.Text = txtTest.Text;
}
}
This is the Process to access data present in Previous Page using CrossPage Postback.
For better Understanding of CrossPage postback you ca refer the following link:
Cross-Page Posting in ASP.NET Web Pages[
^]
Regards.