Using HtmlAnchor or ASP.NET HyperLink for anchor tag that navigates in-page named anchor
Instead of using the NavigateUrl property, just use the href property
<asp:HyperLink href="#namedAnchor" runat="server">HyperLink</asp:HyperLink>
To set the HREF property in codebehind:
HyperLink link = new HyperLink();
link.Attributes.Add("href", "#" + doc.DocumentID.ToString());
link.Text = doc.DocumentNumber;
This will give you:
<a href="#111">blah blah</a>