方法名
用途
示例
RegisterArrayDeclaration
创建JavaScript数组
ScriptManager.RegisterArrayDeclaration(UpdatePanel1,"Hello", ,"1,2,3");
RegisterClientScriptBlock
为对象输出一个函数,为true时自动加上<script></script>
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "HelloWorld", "function helloWorld(){alert(1);}", true);
RegisterClientScriptInclude
添加对脚本文件的引用
ScriptManager.RegisterClientScriptInclude(UpdatePanel1,this.GetType(),
"HelloWorld",Server.MapPath("test.js"));
RegisterClientScriptResource
访问程序集中的脚本文件
ScriptManager.RegisterClientScriptResource(UpdatePanel1,this.GetType(),
"test.js");
RegisterExpandoAttribute
为指定控件添加额外的属性
ScriptManager.RegisterExpandoAttribute(UpdatePanel1,Button1.ClientID,
"attributeName","attributeValue",true);
RegisterHiddenField
添加个隐藏值
ScriptManager.RegisterHiddenField(UpdatePanel1, "hiddenFieldName", "hiddenFieldIntialValue");
RegisterOnSubmitStatement
提交的Confirm
ScriptManager.RegisterOnSubmitStatement(UpdatePanel1,this.GetType(),
"test", "return window.confirm('test')");
RegisterStartupScript
添加一个最开始运行的脚本
ScriptManager.RegisterStartupScript(UpdatePanel1,this.GetType(), "HelloWorld", "alert('The page has loaded!')",true);