Disable Calendar Control from javascrip

R

Robert Ladd

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top