Search code examples
htmlasp.netcommentsascx

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


Why does the commented control STILL search for it's tagName... What's the point... I mean, it's in comments, it's not suppose to even EXIST in the code. This is what comments are for, your supposed to be able to make that part of code invisible for the compiler. It dosen't makes sense to me that it's not. Can someone tell me what is going on ?

Edit :


I've been asked to show the kind of comments it was, so i'm going to post all the control.

<%@ 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);" />
  <% } %>

Solution

  • Thanks to Daniel Cook. Using ASP.net comments instead of HTML comments solved the question.

    Use :

    <%--  Comments   --%>
    

    instead of :

    <!--  Comments   -->