Disable Calendar Control from javascrip

Discussion in 'ASP .Net' started by Robert Ladd, Feb 27, 2005.

  1. Robert Ladd

    Robert Ladd Guest

    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
     
    Robert Ladd, Feb 27, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?utf-8?B?4pmlZVh0cmVtZSBvWHlnZW7imaU=?=

    How do i call JAVASCRIP function if...

    =?utf-8?B?4pmlZVh0cmVtZSBvWHlnZW7imaU=?=, Aug 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    481
    =?Utf-8?B?QXVndXN0aW4gUHJhc2FubmE=?=
    Aug 25, 2006
  2. Ganesh
    Replies:
    1
    Views:
    444
    clintonG
    Aug 2, 2007
  3. deepak kumar
    Replies:
    0
    Views:
    140
    deepak kumar
    Oct 30, 2004
  4. Alex Maghen

    "ASP:" WebControls and Non-JavaScrip

    Alex Maghen, Feb 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    161
    Scott M.
    Feb 9, 2005
  5. cz
    Replies:
    4
    Views:
    768
    Eric Christopherson
    Feb 15, 2011
Loading...

Share This Page