Triple Quotes? How do I delimit a databound Javascript string parameter in ASP.NET?

I had recently similar problem and the only way to solve it was to use plain old HTML codes for single (') and double quotes (").

Source code was total mess of course but it worked.

Try

<a id="aShowHide" onclick='ToggleDisplay(&#34;<%# DataBinder.Eval(Container.DataItem, "JobCode") %>&#34;);'>Show/Hide</a>

or

<a id="aShowHide" onclick='ToggleDisplay(&#39;<%# DataBinder.Eval(Container.DataItem, "JobCode") %>&#39;);'>Show/Hide</a>

Leave a Comment