passing control inside detaliview or gridview to javascript
-
I have a asp:calendar with id Calendarstartdate inside detailview which I want to show and hide base on a button just next to it. But when I access calendar1 in javascript var CalRef = document.getElementById('<%=Calendarstartdate.ClientID%>'); I get compile error The name 'Calendarstartdate' does not exist in the current context how do I overcome this and get correct id of calendar
//java script function HideshowCalendar() { var CalRef = document.getElementById('<%=Calendarstartdate.ClientID%>'); }
-
I have a asp:calendar with id Calendarstartdate inside detailview which I want to show and hide base on a button just next to it. But when I access calendar1 in javascript var CalRef = document.getElementById('<%=Calendarstartdate.ClientID%>'); I get compile error The name 'Calendarstartdate' does not exist in the current context how do I overcome this and get correct id of calendar
//java script function HideshowCalendar() { var CalRef = document.getElementById('<%=Calendarstartdate.ClientID%>'); }
To figure out what's going on, open your page in the browser, then select "view source" (from the brower menu). Look at the html code and your javascript function. Is there a DOM element with the ID your javascript is attempting to hide/show? This should give you an indication of where the problem is.
Steve