Question

I create a new web project in Visual studio and put one asp:LinkButton Control in Default.aspx.

<asp:LinkButton runat ="server" ID="lnkTest"><lll</asp:LinkButton>

When I start the project and Visual Studio redirects me to the browser nothing is render. If I go to View Page source everything looks fine

<a id="MainContent_lnkTest" href="javascript:__doPostBack(&#39;ctl00$MainContent$lnkTest&#39;,&#39;&#39;)"><lll</a>

If i go to Inspect Element, the tool show me this:

<a id="MainContent_lnkTest" href="javascript:__doPostBack('ctl00$MainContent$lnkTest','')"><lll< a>

    </lll<></a>

Why this happen and can I fix it.

P.S. If the text not start with '<' rendering is normal and the control is visible.

Was it helpful?

Solution

Don't use < if you want it to appear as normal text. Use an html entity instead:

<asp:LinkButton runat ="server" ID="lnkTest">&lt;lll</asp:LinkButton>

Use &lt;, &#60;, or &#x3C;, any one should work.

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