I am creating a website in c# where there are two forms.
In form1.aspx i have a textbox and a Next page button which redirects to form2.aspx and in form2.aspx there is a Previous page button which redirects to form1.aspx. I want that when i click on previous page button, same previous value should b returned in text box on form1.aspx.
form1.aspx design view
<form id="form1" runat="server">
<asp:Button ID="btnNext" runat="server" Text="NextPage" OnClick="btnNext_Click" />
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
</form>
form1.aspx code beind
public partial class Form1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnNext_Click(object sender, EventArgs e)
{
Response.Redirect("Form2.aspx");
}
}
form2.aspx design page
<form id="form1" runat="server">
<asp:Button ID="btnPrev" runat="server" Text="previous" OnClick="btnPrev_Click" />
</form>
form2.aspx code beind
public partial class Form2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnPrev_Click(object sender, EventArgs e)
{
Response.Redirect("Form1.aspx");
}
}
I am sorry if this is a stupid question. But please help me out.
Thanks in advance
Regards,
Abhishek
If you do not want to create a session value for the same, you can alternately save required data into cookie, ONLY if it is not of much value, and then populate from cookies. Please note that do NOT save data in cookies, which can be used by other users of client computer to misuse your website. Here I do not think this could be a secure site and the data of too much value.