Wednesday, 28 November 2012

how to get previous page value in asp.net

In First Page
--------------
   protected void btn_Click(object sender, EventArgs e)
    {
           //hnd is the hidden field
            hdn.Value = "sajil";
            Server.Transfer("SecondPage.aspx", true);
     }
In second Page
--------------
 You can get this hdn value in the second page using the code below

   protected void Page_Load(object sender, EventArgs e)
  {
    HiddenField txt = (HiddenField)Page.PreviousPage.FindControl("hdn");
    Response.Write(txt.Value);
  }

No comments:

Post a Comment