467,877 Members | 1,304 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

Disable Calendar Control from javascrip


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

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.

Nov 19 '05 #1
  • viewed: 3100

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tim Graichen | last post: by
5 posts views Thread by Miguel Dias Moura | last post: by
1 post views Thread by bill yeager | last post: by
2 posts views Thread by Caesar Augustus | last post: by
3 posts views Thread by Peter | last post: by
3 posts views Thread by =?Utf-8?B?UGFycm90?= | last post: by
7 posts views Thread by John Kotuby | last post: by
3 posts views Thread by thorpk | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.