zoukankan      html  css  js  c++  java
  • 组件开发中的内嵌资源引用

    类名字空间前资源注册
    [assembly: System.Web.UI.WebResource("XXX.js.FilePlugin.js", "text/javascript")]

    OnPreRender事件
                //资源名称
                string _strResourceKey = ""; //资源名称
                ClientScriptManager _csm = Page.ClientScript;


                    //if (this.Page.Header.FindControl(_strResourceKey) == null)
                    //{
                    //    string _src = _csm.GetWebResourceUrl(this.GetType(), _strResourceKey);

                    //    Literal _literal = new Literal();
                    //    _literal.ID = _strResourceKey;
                    //    _literal.Text = string.Format("\n<script type=\"text/javascript\" src=\"{0}\" ></script>", _src);

                    //    this.Parent.Page.Header.Controls.Add(_literal);                   
                    //}

                    //if (!this.Page.ClientScript.IsStartupScriptRegistered(_strResourceKey))
                    //{
                    //    string _src = _csm.GetWebResourceUrl(this.GetType(), _strResourceKey);
                    //    _src = string.Format("\n<script type=\"text/javascript\" src=\"{0}\" ></script>", _src);
                    //    Page.ClientScript.RegisterStartupScript(this.GetType(), _strResourceKey, _src);
                    //}

                    if (!this.Page.ClientScript.IsClientScriptIncludeRegistered(_strResourceKey))
                    {
                        string _src = _csm.GetWebResourceUrl(this.GetType(), _strResourceKey);
                        Page.ClientScript.RegisterClientScriptInclude(this.GetType(), _strResourceKey, _src);
                    }

  • 相关阅读:
    MeshLab编译理解
    几个经典的数学库之一学习---VCGlib(1)
    开源协议的几种类型认识
    Win & Mac 系统之间U盘传递的U盘文件格式选取问题
    用VS2010编译python2.7的源码
    类之间关系理解:组合>聚合>关联>依赖;实现,继承
    Linux进阶:让效率翻倍的Bash技巧(一)
    Linux下nc命来实现文件传输
    nginx 405 not allowed问题的解决
    vim同时打开多个文件进行编辑
  • 原文地址:https://www.cnblogs.com/shijun/p/2297883.html
Copyright © 2011-2022 走看看