Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hello all,

i am having a problem.When i was working in an application without master page and content page, javascript was working finely.But later i needed to use mastr paga in my project.After using master page, javascripts is giving error on call of the function.
error is like below.

"Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object"

how should i put the javascript in content page.

please help as soon as possible.

thanking you
//
function enable()
{
document.getElementById('<%= txtID.ClientID%>').disabled=true;
Posted
Comments
AshishChaudha 10-Jan-13 3:39am    
could you please share your code of javascript

When masterpage is added, the the id's of elements on the page are changed. You should view your page in browser and watch its code. There you will have the correct ID generated for the element("txtID"). In your javascript function use the ID generated in the HTML source code of your page.
 
Share this answer
 
When you are working with master page right click on the page in IE browser from there you can get the id of the control in non-conventional format (unlike regular id) use that id in java script. Follow this process and try sure you will get it. Any doubts ask me.



Happy Coding.......
 
Share this answer
 
v2
you cant specify the id value like this
 
Share this answer
 

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