I had the same problem in my web application (this.datetimeformat is undefined), indeed, this is due to an error in Microsoft Ajax, and this function overloads the function that causes the error in MS Ajax.
But there are some problems with the code above. Here is the correct version.
string str = @"Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) { if (!this._upperAbbrMonths) { this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames); } return Array.indexOf(this._upperAbbrMonths, this._toUpper(value)); };"; ClientScriptManager cs = Page.ClientScript; if(!cs.IsStartupScriptRegistered("MyScript")) { cs.RegisterStartupScript(this.GetType(), "MyScript", str, true); }
Place the Page_Load event of your webpage in the codebehind file. If you use master pages, put them on your child page, not on the main page, because the code on the child pages will run to the main page, and if it is in the code on the main page, you still get an error if you Use AJAX on child pages.
Cyril gupta
source share