Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 .
Posted

use this code


Response.Write( "<script
language=\"javascript\">\nalert('message');\n</script>\n" );
 
Share this answer
 
User below code

C#
ClientScript.RegisterStartupScript(this,this.GetType(),"message","alert('My Message');",true);
 
Share this answer
 
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:
C#
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Notification : Record Saved Successfully');", true);



--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900