Question

I am having an issue where composite child controls are encoding strings to HTML. I have a child control button that is set like so:

b.OnClientClick = "$('#pic').rotateRight();";

the trouble with this is when the composite control is rendered to a web page the source displays:

onclick="$('#pic').rotateRight();" />

Obviously I don't want ', I want to have apostrophes ' , nothing I seem to try works, it always comes out encoded. This is required to get some basic jquery functionality working. Any workarounds?

Was it helpful?

Solution

Here's a solution

http://avinashsing.sunkur.com/2010/10/29/asp-net-html-encoding-attributes-in-server-controls/

Apparently it will still work with the HTML encoding, which makes sense, though I've not tested this myself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top