在Updatepanel中使用JAVASCRIPT的问题

在UpdatePanle总使用javascript如: Response.Write("<script language='javascript'>alert('" + error.Message.ToString() + "');history.back(-1);</script>"); 时,弹出来一个提示对话框
Sys.WebForms.PageRequestManagerParserErrorException:
The   message   received   from   the   server   could   not   be   parsed   .   Common   causes   for   this   error   are   when   the   response   is   modified   by   calls   to   Responsed.Write(),response   filters,HttpModules,   or   server   trace   is   enabled.
Details:Error   parsing   near' ("<script language='ja'
原因可能是是UpdatePanel里面不支持js脚本。
直接更改此语句为如下即可
System.Web.UI.ScriptManager.RegisterStartupScript( UpdatePanel1, this.GetType(), "", "alert('" + error.Message.ToString() + "');history.back(-1);", true);

你可能感兴趣的:(JavaScript)