Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Value of Hidden Field in Client Side

Tags:

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?

like image 425
MusicLovingIndianGirl Avatar asked Oct 23 '13 07:10

MusicLovingIndianGirl


People also ask

How do you get hidden field values in typescript?

var h = document. getElementById('myHiddenField');

How do you keep a hidden field value on a postback?

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.


1 Answers

That returns the input. You need the value of the hidden input.

StatusFlag = document.getElementById('<%= HiddenStatusFlag.ClientID%>').value; 
like image 122
nunespascal Avatar answered Oct 13 '22 21:10

nunespascal