I am trying to add a new line Javascript alert message. I tried '\n' and 'Environment.NewLine'. I am getting Unterminated string constant error. Could you please let me know what could be the problem? I appreciate any help. I also tried \r\n.

I know i posted below to add an @ in front of "string msg", but upon further review, you should probably add it in here: String.Format(@"<script...." - or both. If you already tried this, which line is generating the error?
–
LosbearSep 26 '12 at 14:34

The code looks fine, so I'm going to guess that you're using a message that itself has a ' quote in it, causing the JS syntax error. For inserting dynamic text into a Javascript code block, you really should use JSON to make your C# strings 'safe' for use in JS.

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
–
Jav_RockSep 26 '12 at 14:24

I tried @ symbol. I still get the same error.
–
nav100Sep 26 '12 at 14:25