Click here to Skip to main content
14,300,872 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

use this code


Response.Write( "<script
language=\"javascript\">\nalert('message');\n</script>\n" );
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

User below code

ClientScript.RegisterStartupScript(this,this.GetType(),"message","alert('My Message');",true);
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100