0

I have a chart and I'm attempting to implement a javascript alert pop-up with information about the associated data point onmouseover.

Chart1.Series[0].Points[0].MapAreaAttributes = "onmouseover=\"javascript:alert('" message + "');\"";

where I have message defined:

string message = String.Format("{0} = {1}{2}{3} = {4}", "X", "#VALX", @"\n", "Y", "#VALY" ;

The issue I'm facing is I'm getting a SCRIPT1015: Unterminated string constant. I know it has to do with me trying to insert the new line character @"\n" because when my message doesn't have the newline character it works correctly.

Two possible solutions I've come across are to use HttpUtility.JavaScriptStringEncode or to use String.Replace(). I've tried fiddling with both but have had no success.

0 Answers0