为什么可以';我不能在asp.net中注释掉一个updatepanel吗?

为什么可以';我不能在asp.net中注释掉一个updatepanel吗?,asp.net,comments,repeater,Asp.net,Comments,Repeater,我创建了一个空白页面,并添加了以下内容,从而生成了一个正确运行的页面: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel> 然后我将其更改为以下内容: <asp

我创建了一个空白页面,并添加了以下内容,从而生成了一个正确运行的页面:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    </asp:UpdatePanel>

然后我将其更改为以下内容:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <!--<asp:UpdatePanel ID="UpdatePanel1" runat="server">-->
    <!--</asp:UpdatePanel>-->

为什么这会导致一个错误,说我不能在更新面板中有“->”文字

谢谢

这是错误的:

<!--<asp:UpdatePanel ID="UpdatePanel1" runat="server">-->
<!--</asp:UpdatePanel>-->

这是正确的:

<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    </asp:UpdatePanel>--%>

编辑:

ASP.NET支持一种鲜为人知的功能,称为“服务器端注释”,可用于完全禁用页面中的代码/控件/html。ASP.NET中的服务器端注释使用


关键区别在于,对于客户端评论,浏览器忽略了其中的内容。客户端注释中的代码/控件仍将在服务器上执行并发送到浏览器。因此,如果它们内部出现服务器错误,则会阻止运行页面。

客户端注释,如


+1你是对的,但你还没有回答OP的实际问题。。。这就是为什么你必须这样做的原因是的。谢谢如果我能用@Chilleo,你就是weclome。希望你能纠正它。
<asp:UpdatePanel ID="UpdatePanel1" runat="server">-->     
<!--</asp:UpdatePanel>
<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
</asp:UpdatePanel>--%>