微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

.net – 如何注册启动脚本?

我对.net的经验有限.我的应用程序抛出一个错误this.dateTimeFormat是未定义的,我追溯到一个已知的ajax错误.发布的解决方法说:

“将以下内容注册为启动脚本:”

Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value)
{
if (!this._upperAbbrMonths) {
this._upperAbbrMonths = this._toupperArray(this.dateTimeFormat.AbbreviatedMonthNames);
}
return Array.indexOf(this._upperAbbrMonths,this._toupper(value));
};

那我该怎么做?我是否将脚本添加到我的aspx文件底部

你会用 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)
}

原文地址:https://www.jb51.cc/ajax/159938.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐