Click here to Skip to main content
Sign Up to vote bad
good
See more: C#4.0
Hi all,
I am developing a web application in which i need to store a some values in a hiddenfield and i need to access this values in other pages. I need to post huge data and so i prefer using HiddenField than Session or QueryString. I am using the following code.
 
Default1.aspx
 
 <asp:HiddenField ID="hdnEmailID" runat="server" />
 
Default1.aspx.cs
 
protected void LinkGroupSummary_Click(object sender, EventArgs e)
        {            
            hdnEmailID.Value = this.EmailList;
            Server.Transfer("Default2.aspx");
 
        }
 
Default2.aspx.cs
 

if (Page.PreviousPage != null)
                    {
                        HiddenField MyHiddenValue = (HiddenField)Page.PreviousPage.FindControl("hdnEmailID");
                        if (MyHiddenValue != null)
                        {
                            string email = MyHiddenValue.Value;
                        }
                    }

In the Default.aspx.cs page, i am getting MyHiddenField as null always.
 
Please help.
 
Thanks in advance,
Sruthi R
Posted 18 Jun '12 - 16:40
SruthiR1.3K
Edited 18 Jun '12 - 18:30
sravani.v15.6K


2 solutions

How to: Pass Values Between ASP.NET Web Pages[^] should be the perfect link for you to go through. Have a look at how _VIEWSTATE_ automatically passes hidden fields when posting data.
  Permalink  
Comments
Amit Kmr Sinha - 18 Jun '12 - 23:56
Good reference. MSDN is the best. My +5.
Pankaj Nikam - 19 Jun '12 - 1:26
+5 Awesome!
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 355
1 Sergey Alexandrovich Kryukov 338
2 Arun Vasu 315
3 Maciej Los 208
4 Aarti Meswania 180
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,549
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid