First item is replaced with the second instead of getting added
first page
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["text1"] != null && Session["text2"] != null)
{
ListBox1.Items.Add(Session["text1"].ToString());
ListBox1.Items.Add(Session["text2"].ToString());
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default4.aspx");
}
}
second page
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Goback_Click(object sender, EventArgs e)
{
Session["text1"] = TextBox1.Text;
Session["text2"] = TextBox2.Text;
Response.Redirect("Default.aspx");
}
}
i have already tried that,
But First item in the listbox is replaced with the second one ,
As Postback occurs ,thats why i have tried with history.go(-1),
Is there any other way to keep the items without replacing
Swati