Anti-Rich
September 5th, 2007, 02:17 AM
Hi All,
I am beating my head against a brick wall right now, because i am trying to pass a string to a javascript function called Tip, which will show a tooltip when hovering over an image. basically, if the string has any single quotes, it craps itself. i know how escape chars work (or i think i do) but it doesnt seem to make a difference:
imgTableImage1.Attributes.Add("onMouseOver", "Tip('<table border="1" cellspacing="5"><tr><th colspan="1" style="font-size:8pt;background:#ffcccc;">" + longFix + "</th></tr><tr><td style="font-size:8pt;background:#ffffff;">" + sFullText.ToString() + "</td></tr></table>',WIDTH, 200, FADEIN, 500, FADEOUT, 500)");
that is the snippet which adds the tooltip functionality, and longFix is where i have been attempting to put the 'fixed' string.
i have tried using:
longFix.Replace("'", "\'");
longFix.Replace("'", @"\'") //this one puts in a second slash after the first
longFix = Regex.Replace("[']", @"\'");
and i STILL am having no luck.. can anyone see where i am going wrong?
cheers
adam
I am beating my head against a brick wall right now, because i am trying to pass a string to a javascript function called Tip, which will show a tooltip when hovering over an image. basically, if the string has any single quotes, it craps itself. i know how escape chars work (or i think i do) but it doesnt seem to make a difference:
imgTableImage1.Attributes.Add("onMouseOver", "Tip('<table border="1" cellspacing="5"><tr><th colspan="1" style="font-size:8pt;background:#ffcccc;">" + longFix + "</th></tr><tr><td style="font-size:8pt;background:#ffffff;">" + sFullText.ToString() + "</td></tr></table>',WIDTH, 200, FADEIN, 500, FADEOUT, 500)");
that is the snippet which adds the tooltip functionality, and longFix is where i have been attempting to put the 'fixed' string.
i have tried using:
longFix.Replace("'", "\'");
longFix.Replace("'", @"\'") //this one puts in a second slash after the first
longFix = Regex.Replace("[']", @"\'");
and i STILL am having no luck.. can anyone see where i am going wrong?
cheers
adam