Double-qoutes problem in CreateChildControls()

C

chris

In my CreateChildControls() function, I am adding onClick code to a HyperLink
control. The OnClick makes a call to a javascript function and looks like
this:

_hlDisplay.Attributes.Add("OnClick", "javascript:showPopup(document.all." +
this.ClientID + "_" + textBox.ID + ", " + "\"test string\")");

The problem is the double-quotes around the 2nd parameter, "test string". I
would like the above to render as:

<a href='javascript:void(0);'
OnClick='showPopup(document.all.testControl_textBox, "test string"'>click</a>

Unfortunately, I keep getting the double-quotes replaced by " in the
rendered HTML:

<a href='javascript:void(0);'
OnClick='showPopup(document.all.testControl_textBox, &quit;test
string&quit;'>click</a>

I have tried the \" shown above, as well as '\u0022'.

Suggestions?
 
L

Levi Rosol

wouldn't this work as well?

_hlDisplay.Attributes.Add("OnClick", "javascript:showPopup(document.all." +
this.ClientID + "_" + textBox.ID + ", "'"test string""")");


--
Thanks
Levi Rosol

Find Cheap .Net Server Controls At:
http://www.IvelDesigns.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top