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>

onclick='javascript:ToggleDisplay("<%# DataBinder.Eval(Container.DataItem, "JobCode")%> "); '

Use like above.


Without the extra quotes around the input string parameter, the Javascript function thinks I'm passing in an integer.

Can you do some rudimentary string function to force JavaScript into changing it into a string? Like

value = value + ""