Click here to Skip to main content
15,878,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All,


I want to Access Hiddenfield from .aspx page to master page in Javascript,
Here reason is that,because I have disabled Enter key on Master Page,and I want to enabled enter key on some aspx pages,so i am declaring hiddenfield page on which required enter key enabled and set its value 1 for that page and this value i have to check on Master Page javascript where I have disbled Enter key,so If(hidfieldval==1) then i will be enabled enter key for that page.

So please tell me about that,how can i do this?
Posted

using JQuery,
you can get or set the value of the hidden field.

To Set Value :
$("input[id$=HiddenField1]").val("value");

To Get Value
var hdnFieldVal = $("input[id$=HiddenField1]").val();
 
Share this answer
 
In javascript if there is a masterpage then id of the control will only be accessed by viewing the view source of a web browser at run time.
somewhat like below:


C#
document.getElementID("ctl00_HiddenField1").Value



it will help you...let me know...
 
Share this answer
 
Comments
madhuri@mumbai 10-Apr-12 2:39am    
Thanks,
AshishChaudha 10-Apr-12 2:46am    
you can also use below this

document.getElementID(<% hiddenField1.clientid %>).Value

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