When we develop an ASP.NET site, if we use jQuery UI Datepicker in combination with ASP.NET validation controls (such as RequiredFieldValidator):
Then when we select a date in Datepicker, "'length' is empty" will appear or is not an object" error. This is caused by a bug in Datepicker. After my research, I found a very simple solution - capture the onSelect event of Datepicker but do not do any processing:
$("#<%= txtDate.ClientID %>").datepicker({
onSelect: function( dateText, inst) {
//No processing
}
});
Now when we select a date, "'length' is empty" will not appear or is not an object" error, and the ASP.NET validation control can run as usual.