passing invalid Javascript string in C#
Dear All,
I have the following code:-
StringBuilder strInvalid = new StringBuilder();
string strErrorMessage;
strErrorMessage = "Johann";
strErrorMessage = strErrorMessage + '\n';
strErrorMessage = strErrorMessage + "Montfort";
strInvalid.Append("<script language='javascript'> alert('");
strInvalid.Append(strErrorMessage);
strInvalid.Append("');</script>");
this.RegisterStartupScript("startup",strInvalid.ToString());
Basically what I am trying to do is skip a line between Johann and Montfort, however the script is not working.
I am guessing there is a missing character somewhere, however I am not very good in Javascript
Thanks for your help and time
Johann