Click here to Skip to main content
15,895,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get hidden field value in child page to next page in asp.net

thanks
i am explaining my problem:
i have a grid view in which there are hidden fields, there is a edit image button on the grid.
on click event of this button i have response.redirect to next page. on next page i want values of these hidden fields values on label and text box control for updating purpose.
now how i take these values to next page in asp.net vb code.please help.
thanks

please help me.
Posted
Updated 20-Apr-12 21:59pm
v3
Comments
Sandeep Mewara 20-Apr-12 13:46pm    
By child page, do you mean a popup? For just Page A to Page B?

Try this:

C#
HiddenField hdnFieldValue = (HiddenField)PreviousPage.FindControl("hdnFieldid");


hope it helps :)
 
Share this answer
 
Comments
Sandeep Mewara 20-Apr-12 13:49pm    
PreviousPage would not work directly and thus this solution might not work.
1. set the PostBackUrl property of the Button to the New Page
ASP.NET
<asp:button id="Button1" runat="server" text="test now " postbackurl="~/Default5.aspx" xmlns:asp="#unknown" />

or you can use
C#
<asp:button id="Button1" runat="server" text="test now " xmlns:asp="#unknown">
onclick="Button1_Click2" /></asp:button>

code behind
Hi ,
Try this
C#
protected void Button1_Click2(object sender, EventArgs e)
{
          Server.Transfer("Default5.aspx");
 
}

Note : Response.Redirect("Default5.aspx"); will raise
Error Object reference not set to an instance of an object.
in the the other page
C#
  protected void Page_Load(object sender, EventArgs e)
   {
// this is page Default5
       if (!IsPostBack)
       {
        HiddenField hd = ((HiddenField)PreviousPage.FindControl("HiddenField1"));
        string  xx = hd.Value;
       }
 
   }


Best Regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900