开发者

I commented out HTML code, but the control inside it is not disabled

I commented out my table开发者_Python百科 in HTML code. Although the table does get removed, the control inside it seems to persist.

<div>
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" ForeColor="#0066CC"></asp:Label>
    <!--
    <table>
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" ForeColor="#0066CC"></asp:Label>
            </td>
        </tr>
    </table>
    -->
</div>

When I run my application, visual studio give me an error:

The ID 'Label1' is already used by another rcontrol.

I do not know why visual studio still checks the control inside the commented out portion of my HTML. Does anybody have any clue on this matter? Thanks in advance!


That is html comment, not the asp.net server side comment. You should use <% -- code --%>

<%--
    Commented out HTML/CODE/Markup.  Anything with
    this block will not be parsed/handled by ASP.NET.

    <asp:Calendar runat="server"></asp:Calendar> 

    <%# Eval(“SomeProperty”) %>     
--%>

Take a look at Scott Guthrie's post

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜