I have a textbox control Super1 in my MasterPage.
I am using javascript to access this control from my content page like this:
<asp:Content ID='ContentPage' ContentPlaceHolderID='ContentPlaceHolder1' Runat='Server'> <script type='text/javascript'> function Somethin() { { document.forms[0].elements['Super1'].value = 'sdfsd'; //document.getElementById('<%=Super1.ClientID%>').value = 'sdfsdf'; } } </script> </asp:Content>
But while page load it says Super1 not found. How can I access Super1?
In your masterpage’s onload add this code :
this will add your script to the end of the page.
EDIT : I just realized, you use your controls ID directly in your javascript code. this may cause the exception. I update your code to fix it.
I hope this helps.