Hi,
I'm trying to disable the asp.net calendar control from a javascript
function, but it doesn't disable the doPostBack.
To simplify the situation, assume a page with 4 controls. A dropdownlist, a
calendar control, a textbox and an update button. What I'm doing is
initially setting the button to disabled, the other 3 controls are enabled.
If any data is entered in the textbox, I want to disable the dropdownlist
and the calendar control and enable the update button.
I set the onBlur event of the textbox to a javascript function so that I
will disable the dropdownlist and the calendar control and enable the update
button.
The function runs, the disable of the dropdownlist is fine, the enable of
the update button works, even the graying out of the days on the calendar
happens, but the problem is that the doPostBack on each calendar day is
still enabled allowing the user to click on any day and cause a calendar
postback. I want to block the calendar postback while there is data in the
textbox to update via the update button postback.
The javascript code that I'm using to change the control is:
document.getElementById("dropDownList1").disabled = true;
document.getElementById("Calendar1").disabled = true;
document.getElementById("btnUpdate").disabled = false;
I've tried using document.getElementById("Calendar1").SelectionMode =
"None", document.getElementById("Calendar1").SelectionMode = "0",
document.getElementById("Calendar1").SelectionMode = 0, and none of those
did anything.
There doesn't seem to be a way to get the ID of each day so that I could try
to loop through the days and set them to disabled.
If anyone has any ideas I'd appreciate the help.
Bob