Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

RegisterHiddenField doesn't create hidden field

Posted on 2006-06-20
6
544 Views
Last Modified: 2007-12-19
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
Comment
Question by:dtburdick
  • 3
  • 3
6 Comments
 
LVL 27

Expert Comment

by:Sammy
ID: 16943244
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
 

Author Comment

by:dtburdick
ID: 16943379
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
 
LVL 27

Accepted Solution

by:
Sammy earned 125 total points
ID: 16943588
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:dtburdick
ID: 16943946
Grrrrr.  Are you doing it using Page.RegisterHiddenField?

Is there anything that needs to be in place for Page.RegisterHiddenField to work?
0
 

Author Comment

by:dtburdick
ID: 16945232
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
 
LVL 27

Expert Comment

by:Sammy
ID: 16945250
worked with the exact code eh?

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question