Hi,
According to your description ,please check the code below,it shows how to keep the old value when the page redirect back.
1.COde in your Webform1.aspx(.cs):
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["1"] != null)
{
this.TextBox1.Text = Session["1"].ToString();
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["1"] = TextBox1.Text;
Response.Redirect("Default.aspx");
}
2.Code in your Default.aspx(.cs):
protected void Page_Load(object sender, EventArgs e)
{
if (Session["1"] != null)
{
switch (Session["1"].ToString())
{
case "1":
TextBox1.Text = Session["1"].ToString();
break;
case "2":
TextBox2.Text = Session["1"].ToString();
break;
default:
break;
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("WebForm1.aspx");
}
Hope it can help you.