华域联盟 .Net asp.net 组件开发中的内嵌资源引用

asp.net 组件开发中的内嵌资源引用

类名字空间前资源注册

复制代码 代码如下:

[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);

}
您可能感兴趣的文章:

  • ASP.NET主机资源控制的一些心得
  • asp.net(C#) 开源资源大汇总
  • asp.net中资源文件的使用
  • 实例讲解.NET中资源文件的创建与使用
  • .NET 资源文件resx、Resources详细说明
  • ASP.NET 服务器路径和一般资源调用
  • 详谈.net中的垃圾回收机制
  • asp.net中virtual和abstract的区别分析
  • ASP.NET实现将word文档转换成pdf的方法
  • ASP.NET配置文件Web.config用法详解
  • ASP.net全局程序文件Global.asax用法分析
  • .net非托管资源的回收方法

本文由 华域联盟 原创撰写:华域联盟 » asp.net 组件开发中的内嵌资源引用

转载请保留出处和原文链接:https://www.cnhackhy.com/43032.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部