views:

308

answers:

1

I use the following control to output a HTML link:

<asp:HyperLink ID="hlEditDetails" runat="server" CssClass="arrow-forward" Text="Edit Details &amp; Photo" />

However, when it does, the markup is generated as:

<a id="ctl00_hlEditDetails" class="arrow-forward" href="/EventName/EditDetails.aspx?ID=1">Edit Details & Photo</a>

The unescaped ampersand is causing an error on the XHTML validator. Is there a way to make the HyperLink control generate the text correctly without writing out the HTML ourselves? The reason we're using the control in the first place is because the URL is dynamic. It's not a huge problem, but very annoying to see validation fail due to .net inflexibility, when the control should be making things easier.

+2  A: 

<asp:HyperLink ID="hlEditDetails" runat="server" CssClass="arrow-forward">Edit Details &amp; Photo</asp:Hyperlink>

works

Nick Spiers