Click here to Skip to main content
15,845,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
var hidval = document.getElementById("<%=hdhidden.ClientID %>");

but hidval is always getting null i tried using sigle quote but it does not help i dont know why i am getting null please help me..

and my aspx page is
<asp:HiddenField ID="hdhidden"  runat="server" Value="mahesh" />
Updated 10-Apr-14 22:44pm
Jignesh Khant 11-Apr-14 3:46am    
var hidval = document.getElementById("<%=hdhidden.ClientID %>").value;

This should work.
Member 10057465 11-Apr-14 3:50am    
no hidval is returning null .value saying object required
Jignesh Khant 11-Apr-14 4:13am    
document.getElementById('<%= hdhidden.ClientID%>')

Dont use value, replace double quotes with single.
Member 10057465 11-Apr-14 5:28am    
yes i have used document.getElementById('<%= hdhidden.ClientID%>') this and also i have tried
at runtime id of that control like

document.getElementById('contentplaceholder_hdhidden') but still i cannot get the control in javascript

document.getElementById('<%= hdhidden.ClientID%>').value;
try this.
Share this answer
Member 10057465 11-Apr-14 5:28am    
yes i have used single quote but still its throwing object required..
[no name] 11-Apr-14 7:23am    
hdhidden.ClientID give direct clietID here ,Inspect ELEMENT > find out the client ID
You can try this...
var hidval = document.getElementById("hdhidden");

If you are using in content page should try the below code...

var hidval = document.getElementById('<%= hdhidden.ClientID%>').value;
Share this answer
Member 10057465 11-Apr-14 5:29am    
yeah i am using content page and tried your code but its throwing object required please help me..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900