asp.net中执行到Response.write(xx);这段语句时出现下面的情况,请问如何改正?

在放置了UpdatePanel时,即便是设置了PostBackTrigger 也无法Response.Write();正常情况下,微软推荐我们是这么用的:string scripts = "<script>alert('弹出提示框!');</script>";ClientScriptManager csm = Page.ClientScript;csm.RegisterClientScriptBlock(this.GetType(), "sss", scripts, false);//csm.RegisterStartupScript(this.GetType(),"sss",scripts,false);如果还不行你就用专门针对UpdatePanel控件的:
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('房间号不存在!');", true); 
你只需将alert('房间号不存在!');改成你输出的脚本即可!

Hi, When you use update panel then you can not call javascript like this .. Try Following Code, string CloseWindow; CloseWindow = "alert('Hello World')"; ScriptManager.RegisterStartupScript(UpdatePanelID,UpdatePanelID.GetType(), "CloseWindow", CloseWindow, true);