• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • 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?
0
dtburdick
Asked:
dtburdick
  • 3
  • 3
1 Solution
 
Sammy AgeilCommented:
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?

0
 
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("ORDERFORM","False");
                  Page.RegisterHiddenField("ECHODATA","True");
                  Page.RegisterHiddenField("SHOWCONFIRM","False");
                  Page.RegisterHiddenField("PARTNER","VeriSign");
                  Page.RegisterHiddenField("LOGIN","dodsbconference");
                  Page.RegisterHiddenField("TYPE","S");
                  Page.RegisterHiddenField("METHOD","CC");
                  Page.RegisterHiddenField("USER1","12345"); //ConfirmNumber
                  Page.RegisterHiddenField("AMOUNT","100");
                  Page.RegisterHiddenField("COMMENT1","");
                  Page.RegisterHiddenField("COMMENT2","");

                  Page.RegisterHiddenField("USER5",Request.Form["USER5"]);
                  this.lblUSER5.Text=Request.Form["USER5"];
                  Page.RegisterHiddenField("PONUM",Request.Params.Get("PONUM"));
                  this.lblPONUM.Text=Request.Params.Get("PONUM");
                  Page.RegisterHiddenField("NAME",Request.Form["NAME"]);
                  this.lblNAME.Text=Request.Form["NAME"];
                  Page.RegisterHiddenField("ADDRESS",Request.Form["ADDRESS"]);
                  this.lblADDRESS.Text=Request.Form["ADDRESS"];
                  Page.RegisterHiddenField("NAME",Request.Form["NAME"]);
                  this.lblNAME.Text=Request.Form["NAME"];
                  Page.RegisterHiddenField("CITY",Request.Form["CITY"]);
                  this.lblCITY.Text=Request.Form["CITY"];
                  Page.RegisterHiddenField("STATE",Request.Form["STATE"]);
                  this.lblSTATE.Text=Request.Form["STATE"];
                  Page.RegisterHiddenField("ZIP",Request.Form["ZIP"]);
                  this.lblZIP.Text=Request.Form["ZIP"];
                  Page.RegisterHiddenField("COUNTRY",Request.Form["COUNTRY"]);
                  this.lblCOUNTRY.Text=Request.Form["COUNTRY"];
                  Page.RegisterHiddenField("PHONE",Request.Form["PHONE"]);
                  this.lblPHONE.Text=Request.Form["PHONE"];
                  Page.RegisterHiddenField("EMAIL",Request.Form["EMAIL"]);
                  this.lblEMAIL.Text=Request.Form["EMAIL"];
                  Page.RegisterHiddenField("USER2",Request.Form["USER2"]);
                  this.lblUSER2.Text=Request.Form["USER2"];
                  Page.RegisterHiddenField("USER3",Request.Form["USER3"]);
                  this.lblUSER3.Text=Request.Form["USER3"];
                  Page.RegisterHiddenField("AMOUNT",Request.Form["AMOUNT"]);
                  this.lblAMOUNT.Text=Request.Form["AMOUNT"];
                  Page.RegisterHiddenField("USER4",Request.Form["USER4"]);
                  this.lblUSER4.Text=Request.Form["USER4"];
                  Page.RegisterHiddenField("CARDNUM",Request.Form["CARDNUM"]);
                  this.lblCARDNUM.Text=Request.Form["CARDNUM"];

                  this.lblExpMonth.Text=Request.Form["ddlExpMonth"];
                  switch (Request.Form["ddlExpMonth"])
                  {
                        case "01":
                              this.lblExpMonth.Text="January";
                              break;
                        case "02":
                              this.lblExpMonth.Text="February";
                              break;
                        case "03":
                              this.lblExpMonth.Text="March";
                              break;
                        case "04":
                              this.lblExpMonth.Text="April";
                              break;
                        case "05":
                              this.lblExpMonth.Text="May";
                              break;
                        case "06":
                              this.lblExpMonth.Text="June";
                              break;
                        case "07":
                              this.lblExpMonth.Text="July";
                              break;
                        case "08":
                              this.lblExpMonth.Text="August";
                              break;
                        case "09":
                              this.lblExpMonth.Text="September";
                              break;
                        case "10":
                              this.lblExpMonth.Text="October";
                              break;
                        case "11":
                              this.lblExpMonth.Text="November";
                              break;
                        case "12":
                              this.lblExpMonth.Text="December";
                              break;
                  }
 
                  this.lblExpYear.Text="20" + Request.Form["ddlExpYear"];

                  Page.RegisterHiddenField("EXPDATE",Request.Form["EXPDATE"]);

            }
0
 
Sammy AgeilCommented:
I just used the first 4 hidden fields and they all showed fine

<div>
<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" />
</div>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Is there anything that needs to be in place for Page.RegisterHiddenField to work?
0
 
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.
0
 
Sammy AgeilCommented:
worked with the exact code eh?

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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