Lets Have a fun with Technology.

BTemplates.com

Follow by Email

Saturday, February 6, 2016

Alter Message box from code Behind in C# Asp.Net


Alter Message Box from Code Behind


Response.Write(@"<script language='javascript'>alert('The following errors have occurred:" + ErrorDesc + ".');</script>");

Now if you want error message in secondLine.
here the trick.

Response.Write(@"<script language='javascript'>alert('The following errors have occurred: \n" + ErrorDesc + " .');</script>");

or you can double escape the \n by doing 

Response.Write(@"<script language='javascript'>alert('The following errors have occurred: \\n" + ErrorDesc + " .');</script>");

0 comments:

Post a Comment