HTML "file.ascx" 中的评论不像评论

HTML comments in "file.ascx" does not behave like comments

为什么注释控件仍然搜索它的标记名...有什么意义...我的意思是,它在注释中,它甚至不应该存在于代码中。这就是注释的作用,您应该能够使编译器看不到那部分代码。对我来说不是这样是没有意义的。谁能告诉我这是怎么回事?

编辑:


有人要求我显示评论的类型,所以我要 post 全部控制。

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Menu.ascx.cs" Inherits="MandatMobile.Controls.Menu"  %>


<!-- THIS MENU IS NOT OK


<div id="divi" style="float: left; position:absolute; left:-60px; top:120px;" >
    <asp:Menu ID="bootMenu" 
    runat="server" 
    Orientation="Vertical" 
    StaticDisplayLevels="1"
    StaticEnableDefaultPopOutImage="False"
    OnMenuItemClick="BootMenu_MenuItemClick" 
    MaximumDynamicDisplayLevels="10" 
    EnableViewState="false"
    CssClass="nav navbar-fix-top" 
    DynamicMenuStyle-CssClass="dropdown-menu" 
    IncludeStyleBlock="false" 
    SkipLinkText=""
    RenderingMode="List">

      <Items>
        <asp:MenuItem  Text="" ImageUrl="~/Img/Hamberger.png" ToolTip="Menu" Value="openMenu">  
       </asp:MenuItem>
    </Items>
</asp:Menu>
</div>

-->

<div id='cont' style="position:absolute;"  >

 <% if (Convert.ToInt32(Session["Level"]) == 3)
    { %>
    <input type="button" id="btnAjax" onclick="$(document).ready(function() { $('#cont').load('Controls/contentAdmin.html');});"  style="float: left; position:absolute; width:40px; height:40px; left:10px;  background-image:url(../Img/Hamberger.png);" />

<%}
  else if (Convert.ToInt32(Session["Level"]) == 2)
  { %>

   <input type="button" id="btnAjaxNormal"  onclick="$(document).ready(function() { $('#cont').load('Controls/contentNormal.html');});"  style="float: left; position:absolute; width:40px; height:40px; left:10px;  background-image:url(../Img/Hamberger.png);" />
  <% } %>

感谢丹尼尔·库克。使用 ASP.net 条评论而不是 HTML 条评论解决了问题。

使用:

<%--  Comments   --%>

而不是:

<!--  Comments   -->