.NET AJAX用了Updatepanel后,再写response.write就不好用了
同理也不能alert(…)了
要想弹出对话窗就需要靠ScriptManager!
弹出对话窗:
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alert", "alert(‘弹出窗口!’)", true);
(当然也可以是UpdatePanel2,UpdatePanel3…)
跳转用:
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "click", "location.replace(‘Nextpage.aspx’);", true);
如果要先弹窗,再跳转用:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert(‘弹出窗口!’);location.replace(‘Nextpage.aspx’);", true);
留下评论