通过本文主要向大家介绍了updatepanel,updatepanel局部刷新,updatepanel用法,updatepanel控件,asp:updatepanel等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
页面中加入了UpdatePanel后,Response.Write("<script>function dis (){alert('这是调用写在server的JS');}</script>")来调用客户端脚本,无任何提示的无反应。如何在UpdatePanel中调用JS客户端脚本呢?
方法:采用 ScriptManager.RegisterStartupScript(Control controlId,Type this.GetType(),String key,String script block)方法。
有人说controlId必须是UpdatePanel里的,其实不然,page控件就可以。
下面给出一个具体的实例:
Page.ClientScript.RegisterStartupScript(this.GetType(), String Key,String Js block ,Bool AddScriptTag),除了注意粗体字以外,其他操作同上。紫色部分不能包含,如写了的话,浏览时会将脚本部分自动注释掉! </div>
方法:采用 ScriptManager.RegisterStartupScript(Control controlId,Type this.GetType(),String key,String script block)方法。
有人说controlId必须是UpdatePanel里的,其实不然,page控件就可以。
下面给出一个具体的实例:
Page.ClientScript.RegisterStartupScript(this.GetType(), String Key,String Js block ,Bool AddScriptTag),除了注意粗体字以外,其他操作同上。紫色部分不能包含,如写了的话,浏览时会将脚本部分自动注释掉! </div>