I have limited experience with .net. My app throws an error this.dateTimeFormat is undefined which I tracked down to a known ajax bug. The workaround posted said to:
"Register the following as a startup script:"
Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value)
{
if (!this._upperAbbrMonths) {
this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
}
return Array.indexOf(this._upperAbbrMonths, this._toUpper(value));
};
So how do I do this? Do I add the script to the bottom of my aspx file?
When you use RegisterStartupScript , it will render your script after all the elements in the page (right before the form's end tag). This enables the script to call or reference page elements without the possibility of it not finding them in the Page's DOM.
RegisterStartupScript(Control, Type, String, String, Boolean) Registers a startup script block for a control that is inside an UpdatePanel by using the ScriptManager control, and adds the script block to the page.
ClientScript. RegisterStartupScript for displaying alert messages. it works fine for the first message, however second message wont display. Though it passes through the code while debugging.
You would use ClientScriptManager.RegisterStartupScript()
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));
};";
if(!ClientScriptManager.IsStartupScriptRegistered("MyScript"){
ClientScriptManager.RegisterStartupScript(this.GetType(), "MyScript", str, true)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With