使用asp.net ajax的updatepanel进行操作后想要调用自己写的脚本,如果在操作中用使用Response.write (js) 会出错,想很很久都不知道问题所在,最后在网上找到了原因.
原来使用updatepanel进行操作要使用ScriptManager的静态方法 RegisterStartupScript 来实现调用.
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('保存成功')", true);
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "window.location.href('#')", true);
本文介绍在ASP.NET AJAX中使用UpdatePanel时如何正确调用自定义JavaScript代码。通过使用ScriptManager的RegisterStartupScript方法实现了局部刷新后的脚本调用。

1384

被折叠的 条评论
为什么被折叠?



