手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net 组件开发中的内嵌资源引用
asp.net 组件开发中的内嵌资源引用
摘要:类名字空间前资源注册复制代码代码如下:[assembly:System.Web.UI.WebResource("XXX.js.FilePlu...

类名字空间前资源注册

复制代码 代码如下:

[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下百度的编码和解码

asp.net网络数据库开发实例精解 源文件

asp.net 时间类 一周的周一和周末的日期

asp.net小孔子cms中的数据添加修改

asp.net后台如何动态添加JS文件和css文件的引用?

asp.net读取excel中的数据并绑定在gridview

asp.net文件上传示例

asp.net中List的使用方法

asp.net简化接收参数值的函数

asp.net(C#)中上传大文件的几中常见应用方法

精品推荐
分类导航