Get Value of Hidden Field in Client Side Get Value of Hidden Field in Client Side asp.net asp.net

Get Value of Hidden Field in Client Side


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

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


If your hiddenfield used runat="server"

Use this code:

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

else use this code:

StatusFlag = document.getElementById("HiddenStatusFlag").value;


Assuming that it's not null you don't use the hiddenfield's value proprty:

var statusFlag = '';var hiddenStatusFlag = document.getElementById('<%= HiddenStatusFlag.ClientID%>');if(hiddenStatusFlag != null){    statusFlag = hiddenStatusFlag.value;}