Why do escape characters break my Telerik call to ResponseScripts.Add(string)?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-14T20:27:34Z Indexed on 2010/04/15 11:33 UTC
Read the original article Hit count: 277

this displays the expected javascript alert message box:

RadAjaxManager1.ResponseScripts.Add("alert('blahblahblah');");

while these does not:

RadAjaxManager1.ResponseScripts.Add("alert('blahblah \n blahblahblah');");
RadAjaxManager1.ResponseScripts.Add("alert('blahblah \r blahblahblah');");
RadAjaxManager1.ResponseScripts.Add("alert('blahblah \r\n blahblahblah');");
RadAjaxManager1.ResponseScripts.Add("alert('blahblah \n\t blahblahblah');");
RadAjaxManager1.ResponseScripts.Add(@"alert('blahblah \n blahblahblah');");
string message = "blahblahblah \n blahblahblah";
RadAjaxManager1.ResponseScripts.Add(message);

I can't find any documentation on escape characters breaking this. I understand the single string argument to the Add method can be any script. No error is thrown, so my best guess is malformed javascript.

© Stack Overflow or respective owner

Related posts about telerik

Related posts about asp.net-ajax