MusicLovingIndianGirl MusicLovingIndianGirl - 1 month ago 6
ASP.NET (C#) Question

Get Value of Hidden Field in Client Side

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?

Answer

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

StatusFlag = document.getElementById('<%= HiddenStatusFlag.ClientID%>').value;