Wrong Month and Year Chosen when Open through ASP.NET Partial Postback
|Reported by:||Mr. Jefferson||Owned by:||Mr. Jefferson|
If a datepicker is open during an ASP.NET partial postback through an UpdatePanel, and the datepicker's control is in that UpdatePanel, then the date chosen will have the wrong year and month. The year will either be 1899 or 1900. This is documented on Stack Overflow here: http://stackoverflow.com/q/9470736/412107.
Set up a new ASP.NET (I've seen this in both 2 and 4) that includes jQuery, jQueryUI, the necessary CSS, and this markup:
Get the focus to the dropdown, using the tab key if necessary. Press the b key to change the selection. Without doing anything else after this, click one of the next/previous month buttons at least once. If you click forward, you'll end up in January of the earliest year in the year dropdown (at time of writing with the above code, that's 2010). If you click backward, you'll end up in December, again with the earliest year in the dropdown. Then if you click a day, you end up with a date containing the displayed month and day but the year 1899 if you went back or 1900 if you went forward.
I've figured out a workaround where I supply a function for onChangeMonthYear and check to see if the year is 1899 or 1900. If so, I set the current date appropriately.
Change History (4)
comment:1 Changed 5 years ago by scottgonzalez
- Owner set to Mr. Jefferson
- Status changed from new to pending
comment:3 Changed 5 years ago by scottgonzalez
- Resolution set to duplicate
- Status changed from new to closed