使用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);