ClientScriptManager.RegisterClientScriptInclude 方法
ClientScriptManager.RegisterClientScriptInclude 方法:向Page对象注册客户端脚本包含。
public void RegisterClientScriptInclude (Type type,string key,string url)
参数:
public void Page_Load(Object sender, EventArgs e)
{
// 定义页面客户端脚本的名称、URL和类型
String csname = "ButtonClickScript";
String csurl = "script_include.js";
Type cstype = this.GetType();

//获取当前页面的一个ClientScriptManager类型的引用
ClientScriptManager cs = Page.ClientScript;

// 判断脚本是不是已经注册到了页面中
if (!cs.IsClientScriptIncludeRegistered(cstype, csname))
{
cs.RegisterClientScriptInclude(cstype, csname, csurl);
}
}
参见博客文章:http://hi.baidu.com/csharpfather/blog/item/9611c96297626fdde6113a4f.html
public void RegisterClientScriptInclude (Type type,string key,string url)参数:
- type:要注册的客户端脚本包含的类型。
- key:要注册的客户端脚本包含的键。
- url:要注册的客户端脚本包含的 URL。
public void Page_Load(Object sender, EventArgs e)
{
// 定义页面客户端脚本的名称、URL和类型
String csname = "ButtonClickScript";
String csurl = "script_include.js";
Type cstype = this.GetType(); 
//获取当前页面的一个ClientScriptManager类型的引用
ClientScriptManager cs = Page.ClientScript;
// 判断脚本是不是已经注册到了页面中
if (!cs.IsClientScriptIncludeRegistered(cstype, csname))
{
cs.RegisterClientScriptInclude(cstype, csname, csurl);
}
}
参见博客文章:http://hi.baidu.com/csharpfather/blog/item/9611c96297626fdde6113a4f.html
本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights.


浙公网安备 33010602011771号