On a button click on my server side, I assign value to the Hidden Field from a column in my table.
Dim dsGetEnquiryDetails = dbl.usp_GetEnquiryRegisterDetails(Val(lblEnquiryRegisterID.Text)).AsQueryable For Each record In dsGetEnquiryDetails HiddenStatusFlag.Value = record.StatusFlag Next
In my client side function I use this, but not getting any value.
var StatusFlag = ''; StatusFlag = document.getElementById('<%= HiddenStatusFlag.ClientID%>');
What am I missing?
var h = document. getElementById('myHiddenField');
If you refresh the page or click on a hyperlink that does a GET, then the value will be lost or revert to the designer-generated default. Back to your question, if you have a designer-generated HiddenField (in the aspx file), it should automatically set the value on postback.
That returns the input. You need the value of the hidden input.
StatusFlag = document.getElementById('<%= HiddenStatusFlag.ClientID%>').value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With