hi,
i have a group of individual radio buttons that i am running some
client-side code on for the onClick event. there is a URL generated by
a code block inside the onClick attribute. the problem is that when i
view-source on the page, .net has html-encoded the quote and ampersand
characters that are in the code block into " and &. i don't
want this to happen. they should stay as literal characters.
<asp:RadioButton onClick='<%#
"javascript:Record(\"../Select.asmx/EnterPreference?ID=" +
DataBinder.Eval(Container.DataItem, "Proposal Nbr").ToString() +
"&pref=3\")" %>' runat="server" Text="3rd Preference"
GroupName="Select1"></asp:RadioButton>
note that the characters in question are the opening and closing quotes
around the one parameter for the javascript Record function, and the
ampersand which is part of the querystring in the url. the javascript
function actually still works, but it is bad markup as far as i'm
concerned and i'd say older browsers wouldn't accept it.
i was able to work around the " character, by inserting a (char)39
instead of the literal quote \" but unfortunately (char)38 has no
effect on the ampersand, it still comes out as &
how can i stop this behaviour? also, i would be interested to know why
..Net behaves like this. normally if i want this to happen, i use
HttpUtility.HtmlEncode, but for some reason this is happening behind
the scenes.
thanks in advance for any help
tim