Answered by:
Getting CalendarExtender and Textbox to Both Fire OnTextChanged Event

Question
-
User-595227182 posted
I have a CalendarExtender control. I set up an OnTextChanged event handler for its TargetControlID TextBox.
As I found on other posts, by having the CalendarExtender's OnClientDateSelectionChanged atrribute fire a javascript with a __doPostBack, I am able to get the CalendarExtender to fire the TextBox's OnTextChanged event.
However, I can't get the TextBox to fire its own OnTextChanged event. If I put AutoPostback="true" on the TextBox, and manually enter a date, I get stuck in an endless Page_Load loop and the event handler never gets hit. Removing AutoPostBack stops the loop, but the event handler still isn't hit.
I stripped out all but the bare minimum of code to run the above, but the TextBox still sends me into the loop.
Any ideas on how to get BOTH controls to use the same OnTextChanged event handler code?
Thanks
Friday, November 8, 2013 5:34 AM
Answers
-
User-595227182 posted
Actually, looks like it is working now. Kind of strange though.
All I did was strip my code to the bare minimum, saw the events worked correctly, then ran Undo (Ctrl-Z) to put everything back. The events still worked. Perhaps something was corrupted or a change made behind the scenes when I put the code back.
Anyway, thanks. If it comes up again, I'll look at these responses again.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 11, 2013 11:01 AM
All replies
-
User-933407369 posted
hi WPUBrett,
I would suggest you try the follow workaround:
fire a textbox's OnTextChanged while enabled=false
http://stackoverflow.com/questions/14646890/fire-a-textboxs-ontextchanged-while-enabled-false
Problem with TextBox and Calendar Extender when using AutoPostBack=true
http://forums.asp.net/t/1520231.aspx
If you need more assistance , please let me know.
Sunday, November 10, 2013 9:38 PM -
User555306248 posted
Refer this - http://www.codeproject.com/Questions/625166/CalendarExtender-firing-onchange-unexpectedly
Sunday, November 10, 2013 10:45 PM -
User-595227182 posted
Actually, looks like it is working now. Kind of strange though.
All I did was strip my code to the bare minimum, saw the events worked correctly, then ran Undo (Ctrl-Z) to put everything back. The events still worked. Perhaps something was corrupted or a change made behind the scenes when I put the code back.
Anyway, thanks. If it comes up again, I'll look at these responses again.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 11, 2013 11:01 AM