Hardships with ASP.NET page lifecycle
I'm trying to write what looks like a pretty simple user control for selecting a range of dates.
I'm using two CalendarExtender AJAX ToolKit things, which are each linked to a TextBox control. There are other buttons to shift the dates around one month or week at a time, and they work fine using session variables to retain selected date values across postbacks. It's the selecting arbitrary dates with the CalendarExtender that is failing.
The problem is that it's always one page reload behind. The first time the Update button is pressed, the new date values are replaced in the textbox with the old values. The second time it's pressed, the old values are finally replaced with the new values.
var dateStr = document.getElementById( '<%=txtTo.ClientID %>' ).value;
document.getElementById( '<%=hiddenTo.ClientID %>' ).value = dateStr;
Session["userDateTo"] = hiddenTo.Value;
I can provide necessary code snippets if required.