Last post Aug 04, 2008 04:43 PM by eActivated
Dec 04, 2007 11:33 AM|loop07|LINK
I have create an Hidden Field in Aspx <input type="hidden" id="MyHiddenField" runat="server"/>
and set value to this hidden field : document.getElementById('MyHiddenField').value = "myvalue";
In cs page, i do this:
HtmlInputHidden hidden = (HtmlInputHidden)Page.FindControl("MyHiddenField");
string a = hidden.Value;
Problem: I am able to get the correct value in IE, but not in Firefox (always null). Any Idea ?
Your help will always appreciated.[:D]
Dec 04, 2007 01:05 PM|NNM|LINK
document.getElementById('MyHiddenField').value = "myvalue";
Are you assigning it the string value "myvalue" ? Or is it just to illustrate? Assuming it is a variable created somewhere in your js code..:
My guess is that there must be an error when creating the variable "myvalue"... One of those things that will work on ie, but not on a normal browser.. So "myvalue" is probably null on firefox...
Dec 04, 2007 01:13 PM|novice_dlh|LINK
Dec 04, 2007 04:41 PM|loop07|LINK
First of all, Thanks for the quick reply.
NNM, Let me justify my condition in detail here:-
var myvalue = "aaa";
document.getElementById('MyHiddenField').value = myvalue;
Then after postback, in my Aspx.cs as following:
In IE, i able to get value of a is "aaa", but in Firefox , i only get the value of a is " " (empty).
Hope this will clear your doubt, NNM. Your help will be appreciated.
Next about the question from novice_dlh.
i have check the page source (html), everything is fine and i'm able to see it with the Id attribute.
Note: This method all work very fine with IE, but NOT IN Firefox. I still cannot find the solution yet. Hope everybody can help. Thanks!
Dec 04, 2007 05:07 PM|NC01|LINK
I just tried this in both IE and FireFox and everything works as advertised.
<form id="Form1" method=post runat="server">
<input type="hidden" id="MyHiddenField" runat="server" NAME="MyHiddenField">
<asp:button id="postBackButton" runat="server" text="Post Back"></asp:button>
document.getElementById('<%= MyHiddenField.ClientID %>').value = 'Some value';
private void Page_Load(object sender, System.EventArgs e)
if ( this.IsPostBack )
Response.Write("MyHiddenField: [" + MyHiddenField.Value + "]<br>");
Dec 05, 2007 05:16 AM|loop07|LINK
Thanks NC01. It works now after trying your method. [:D]
Aug 04, 2008 04:04 PM|eActivated|LINK
I am having the same issues. It works in IE and not in Firefox and Safari.
I have a link here:
To test, press the little calculators. The error occurs, when it does not add the total at the bottom. I tested and it appears to return null when reading the labels that generated via the repeater - whiy that matters? It shouldn;t but that is the only
Any help is appreciated.
Aug 04, 2008 04:43 PM|eActivated|LINK
Ignore this... Case Sensitivity with a custom hashtable got me..