J
Jeff S
In a VB.NET code behind module, I build a string for a link that points to a
JavaScript function. The two lines of code below show what is relevant.
PopupLink = "javascriptopUpWindow(" & Chr(34) & PopUpWindowTitle & Chr(34)
& ", " & Chr(34) & CurrentEventDetails & ")"
strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName &
"</A><BR>"
The problem I have is that when the string variables [PopUpWindowTitle] or
[CurrentEventDetails] contain a string with an apostrophe, then the server
throws an error "Unterminated String Constant". This error shows up prior to
the page rendering in the browser (or as the page is being rendered to the
browser - I'm not sure which - but it's before the page shows up in the
browser).
I tried including JavaScript's "\" escape character - but this does not
solve the problem (e.g., PopUpWindowTitle= Replace(PopUpWindowTitle, "'",
"\' "). The server still throws the Unterminated String Constant error.
What can I do about this? I need to include apostrophes in the JavaScript
function call string and VB.NET is ignoring JavaScript's Escape
character -yet honoring JavaScript's syntax rules.
Thanks in advance.
JavaScript function. The two lines of code below show what is relevant.
PopupLink = "javascriptopUpWindow(" & Chr(34) & PopUpWindowTitle & Chr(34)
& ", " & Chr(34) & CurrentEventDetails & ")"
strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName &
"</A><BR>"
The problem I have is that when the string variables [PopUpWindowTitle] or
[CurrentEventDetails] contain a string with an apostrophe, then the server
throws an error "Unterminated String Constant". This error shows up prior to
the page rendering in the browser (or as the page is being rendered to the
browser - I'm not sure which - but it's before the page shows up in the
browser).
I tried including JavaScript's "\" escape character - but this does not
solve the problem (e.g., PopUpWindowTitle= Replace(PopUpWindowTitle, "'",
"\' "). The server still throws the Unterminated String Constant error.
What can I do about this? I need to include apostrophes in the JavaScript
function call string and VB.NET is ignoring JavaScript's Escape
character -yet honoring JavaScript's syntax rules.
Thanks in advance.