문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top