Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# String new line

I have an ASPX page within my web application, I'm trying to create a string with multiple lines within a string and use it for this method

ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + Message + "');", true);

This code is in the .cs file.

I tried multiple ways to create this string as multi lines but it seems it doesnt work, I have used methods like:

String Message = "Not Authorised to use Sysomos. "+ "<br>" + " Please Email Ian Atkinson for Authorisation";

String Message = "Not Authorised to use Sysomos. "+ Enviroment.NewLine + " Please Email Ian Atkinson for Authorisation";

Both these methods do not work. I have also tried a string builder and no luck.

Any suggestions??

like image 568
BlahWoo Avatar asked Oct 17 '25 01:10

BlahWoo


1 Answers

Try this

String Message = "Not Authorised to use Sysomos. \\n Please Email Ian Atkinson for Authorisation";
like image 114
Amit Avatar answered Oct 18 '25 15:10

Amit