ClientScriptManager.RegisterClientScriptInclude 方法

ClientScriptManager.RegisterClientScriptInclude 方法:向Page对象注册客户端脚本包含。

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

posted on 2008-07-05 13:41  王丹小筑  阅读(1221)  评论(0)    收藏  举报

导航