Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I have a checkbox that will enable/disable 2 datepickers. When I run the following line of code and sender.checked == false the textbox grays out but you can still type in it. Also the calendar icon is enabled and when click it the calendar windows popups. How can I disable/enable the control completely?
Code: JavaScript
function SetTemplateStatus(sender) {
if (sender.checked == true) {
document.getElementById('<%=dtFrom.ClientId%>').disabled = false;
document.getElementById('<%=dtTo.ClientId%>').disabled = false;
}
else {
document.getElementById('<%=dtFrom.ClientId%>').disabled = true;
document.getElementById('<%=dtTo.ClientId%>').disabled = true;
}
}
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You won't be able to do that. DatePicker is not a single DHTML element that you can enable/disable on the client side. You will need to set Enabled to false from the server side. If you want to avoid full page reload, you can use a CallbackPanel or an UpdatePanel.
Thanks
|