javascript警报消息中的错误 [英] error in the javascript alert message

查看:54
本文介绍了javascript警报消息中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当使用 Response.Write(< script> alert(``记录已成功保存记录'');</script>"); 我遇到了以下错误:
Microsoft JScript运行时错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息.导致此错误的常见原因是通过调用Response.Write(),响应筛选器,HttpModules或服务器跟踪来修改响应.
详细信息:
解析< script>"附近的错误alert(``Reco''.
我该如何解决.

whenever am using Response.Write("<script> alert(''Record Saved Successfully'');</script>"); i am getting the fallowing error:
Microsoft JScript runtime error: 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 Response.Write(), response filters, HttpModules, or server trace is enabled.
Details:
Error parsing near ''<script> alert(''Reco''.
How can i solve it .

推荐答案

使用此代码


Response.Write("< script
language = \"javascript \"> \ nalert(``message''); \ n</script> \ n" );
use this code


Response.Write( "<script
language=\"javascript\">\nalert(''message'');\n</script>\n" );


代码下方的用户

User below code

ClientScript.RegisterStartupScript(this,this.GetType(),"message","alert('My Message');",true);


有时使用Response.Write在页面上编写脚本会在重新呈现时产生问题.这也取决于您使用的浏览器.最好使用ScriptManager.RegisterClientScriptBlock.
试试这个:
Sometime writing the script on the page using Response.Write will create problem in rendring. It''s also depends on the browser you are using. Better to go with ScriptManager.RegisterClientScriptBlock.
Try this:
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Notification : Record Saved Successfully');", true);




--Amit




--Amit


这篇关于javascript警报消息中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆