I'm not going to reveal how many days I've been fighting this. I think this should be a high priority issue. I have two applications using virtually identical code, with the same version of the AjaxControlToolkit. Both had multiple CalendarExtenders on a single page. With the associated TextBoxes set for AutoPostback, setting the extender's SelectedDate property caused multiple post backs (lots of them). This caused a big problem with another library that I use. One application automatically showed the correct date in the calendar when clicking on the TextBox. The other showed the current date. I went around and around trying to do work-arounds because there was no logical reason that it would behave differently in the two applications. I was ready to write off this toolkit as unstable.
What was different? In the application that "worked", when I assigned the DateTime string to the TextBox, I used .ToString("d"), and in the one that "didn't work", I just assigned .ToString().
Since this is a "CalendarExtender", could you just automatically strip the time portion from the DateTime string when reacting to the TextBox assignment? Just to see if this was actually necessary or if I was just doing something wrong, I tried using the ClearTime="true" attribute, but that only set the time to midnight. It still didn't select the correct date. I couldn't see any other setting that would affect this.
I think that's an appropriate modification since the time will never be displayed on a calendar control (as far as I know). Also, I'm not quite sure why setting the SelectedDate should cause multiple postbacks. I don't know if that is something you want to look at.
Thanks. Except for instances like this, your toolkit saves me time.
What was different? In the application that "worked", when I assigned the DateTime string to the TextBox, I used .ToString("d"), and in the one that "didn't work", I just assigned .ToString().
Since this is a "CalendarExtender", could you just automatically strip the time portion from the DateTime string when reacting to the TextBox assignment? Just to see if this was actually necessary or if I was just doing something wrong, I tried using the ClearTime="true" attribute, but that only set the time to midnight. It still didn't select the correct date. I couldn't see any other setting that would affect this.
I think that's an appropriate modification since the time will never be displayed on a calendar control (as far as I know). Also, I'm not quite sure why setting the SelectedDate should cause multiple postbacks. I don't know if that is something you want to look at.
Thanks. Except for instances like this, your toolkit saves me time.