• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 561
  • Last Modified:

RegisterHiddenField doesn't create hidden field

One one page I have the RegisterHiddenField call in the Page_Load and it works just fine.  In the very next page I issue the same command in Page_Load and it won't create any of them.  

Is there a setting on the page somewhere that I'm missing?
  • 3
  • 3
1 Solution
check for postback conditions in your code.
can you post the code for the pages with more explanation so we can see what maybe causing this behaviour?

dtburdickAuthor Commented:
I put a postback check and got nothing.

Thanks for help.

Pardon the code's a bit ugly, still developing:

            private void Page_Load(object sender, System.EventArgs e)

                  if ( ! Page.IsPostBack )
                        string s="foobar";

                  // Hidden fields needed for posting to VeriSign
                  Page.RegisterHiddenField("USER1","12345"); //ConfirmNumber


                  switch (Request.Form["ddlExpMonth"])
                        case "01":
                        case "02":
                        case "03":
                        case "04":
                        case "05":
                        case "06":
                        case "07":
                        case "08":
                        case "09":
                        case "10":
                        case "11":
                        case "12":
                  this.lblExpYear.Text="20" + Request.Form["ddlExpYear"];


I just used the first 4 hidden fields and they all showed fine

<input type="hidden" name="ORDERFORM" id="ORDERFORM" value="False" />
<input type="hidden" name="ECHODATA" id="ECHODATA" value="True" />
<input type="hidden" name="SHOWCONFIRM" id="SHOWCONFIRM" value="False" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3MDM2Nzk3MDEPZBYCAgMPZBYCAgEPEA9kFgIeCG9uY2hhbmdlBRZqYXZzY3JpcHQ6Q2hlY2tWYWx1ZSgpZGRkZBYfqo3dmQtCdXzyuAr/lvbuUI2f" />
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

dtburdickAuthor Commented:
Grrrrr.  Are you doing it using Page.RegisterHiddenField?

Is there anything that needs to be in place for Page.RegisterHiddenField to work?
dtburdickAuthor Commented:
I hate it when I get so caught up in figuring out why something doesn't work that I don't just start over.  

I'm rebuilding the page from scratch and it is working fine.  Who knows what the problem is, who cares.

Thanks for the help.  I'll give you the points.
worked with the exact code eh?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now