G
Guest
i have an ASP.NET application that displays confirmation prompts using
javascript. The text of these messages comes from a string resource file. The
script is attached to the button. Code is similar to this:
btn_resetPassword.Attributes.Add("OnClick",
"javascript:return dConfirm('" + confirmationMessage + "')");
This works great unless the message contains an apostrophe. User a word like
"user's" and the routine never runs. No error (other than a browser
notification of "unexpected )"), just doesn't run
We have tried used \, html encoding, double quotes and doubling up the
apostrophe. None of it works. Using the \ does work if we take it out of C#
and put it in a separate javascript file but if we do that we no longer have
access to our string resource file so that's not going to fly
There's got to be a way to do this (i'm an eternal optimist) but we're run
out of ideas as to how
javascript. The text of these messages comes from a string resource file. The
script is attached to the button. Code is similar to this:
btn_resetPassword.Attributes.Add("OnClick",
"javascript:return dConfirm('" + confirmationMessage + "')");
This works great unless the message contains an apostrophe. User a word like
"user's" and the routine never runs. No error (other than a browser
notification of "unexpected )"), just doesn't run
We have tried used \, html encoding, double quotes and doubling up the
apostrophe. None of it works. Using the \ does work if we take it out of C#
and put it in a separate javascript file but if we do that we no longer have
access to our string resource file so that's not going to fly
There's got to be a way to do this (i'm an eternal optimist) but we're run
out of ideas as to how