09 August 2006

asp:HyperLink includes an extra space in the link

Only a minor point, but poor form...
If you have an asp:HyperLink in an ASP.NET2 app then it is sometimes rendered with an extra space within the link which gives an underlined space at the end of the link.

Suppose you have the following:
<asp:HyperLink ID="idLink" runat="server" Text="Hello" />

When rendered incorrectly, there are line breaks between these three lines which causes the problem:
<a id="ctl00_MasterLoginView1_something" href="something.aspx">
Hello
</a>


When rendered correctly, there are no line breaks.

I haven't been able to determine exact circumstances when rendering is incorrect.

No comments: