加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 01:36:28 所属栏目:百科 来源:网络整理
导读:我对.net的经验有限.我的应用程序抛出一个错误this.dateTimeFormat是未定义的,我追溯到一个已知的ajax错误.发布的解决方法说: “将以下内容注册为启动脚本:” Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value){if (!this._upperAbbrMonths
我对.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)
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读