asp.net - Controls in ContentPlaceHolder are not recognized by javascript document.getelementsbyname -
i have calender script in project. using it, have added image , on onclick event call javascript function displaydatepicker:
<img alt="calender" src="calender.jpg" onclick="displaydatepicker('txtbox1', this);"/>
i use masterpage in project , if image , associated textbox control in contentplaceholder, javasript library's function document.getelementsbyname returns null , seems can not detect controls inside contentplaceholder.
i used code page not using masterpage , went well.
i appreciate in advance.
good luck.
your asp textbox may render like:
<input name="ctl00$featuredcontent$txtbox1" id="featuredcontent_txtbox1" type="text"/>
so, in javascript, should use clientid:
<img alt="calender" src="calender.jpg" onclick="displaydatepicker('<%= txtbox1.clientid %>', this);"/>
Comments
Post a Comment