Search This Blog

Tuesday, August 9, 2011

How to display Exception as Java Script Alert Message?

Some times it will be required to display exception message as a script alert.
Here is a code snippet for that from .aspx.cs page:

catch( Exception ex )
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
                return;
            }

No comments:

Post a Comment