Trying to use age.ClientScript.RegisterHiddenField - need help
-
Hi, I have a myPage.aspx page and 2 user controls, ucA and ucB. ucA (parent control) is being used in ucB (child control inherits ucA). Finallly ucB is registered in myPage.aspx. I have two dropdowns in ucB. Now, I am trying to put the selected values of these dropwdowns in a hidden variables using the below code and I am putting this in myPage.aspx page_load code Page.ClientScript.RegisterHiddenField("LabValue", labname selectedvalue using FindControl) Page.ClientScript.RegisterHiddenField("ClientValue", ClientName SelectdValue using FindControl)) The above code runs fine and no errors. Now in the exeternal .js file I am accessing this values as var lv = document.getElementById("LabValue").value; var cv = document.getElementById("ClientValue").value; All look fine. But the issue is no matter what values I put in the LabValue and ClientValue hidden fields I always get the values as 0 for lv and cv (java script variables). Say for instance if LabValue is 10002 when I try to access it via javasacript using document.getElementById("LabValue").value; I always get 0 instead of 10002. It is the same case with the other hidden field too. When I looked at the myPage.aspx viewsource I always see <input type="hidden" name="LabValue" id="LabValue" value="0" /> Am I missing some thing here? Thanks in advance, L