Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以在ASP.NET中的标记内放置注释吗?_Asp.net_Comments - Fatal编程技术网

我可以在ASP.NET中的标记内放置注释吗?

我可以在ASP.NET中的标记内放置注释吗?,asp.net,comments,Asp.net,Comments,我希望在我的.aspx页面中显示这一点,而不使用特殊字符XML标记,这可以实现吗 <asp:ServerTag Property1="a" Property2="b" Property3="c" <%-- Comment why this particular property is necessary --%> Property4="d" /> 但是,我收到错误消息服务器标记不能包含构造。如果我使用HTML标记,我会被告知服务器标记的格式

我希望在我的
.aspx
页面中显示这一点,而不使用特殊字符XML标记,这可以实现吗

<asp:ServerTag Property1="a"
    Property2="b"
    Property3="c" <%-- Comment why this particular property is necessary --%>
    Property4="d" /> 

但是,我收到错误消息
服务器标记不能包含构造。
如果我使用HTML标记,我会被告知服务器标记的格式不正确


是否有其他的语法来实现这一点?

不一定是这样的,但是你可能想考虑在C语言中装饰属性,让用户知道它的相关性。之后,当您尝试设置它时,诸如resharper(或者可能是vs)之类的东西将为您提供此信息

这是不可能的,不可能。服务器标记必须是格式良好的XML,而XML中不能有这样的标记。当然,您可以在顶部添加注释,如下所示:

<!-- Property2 needed because... -->
<asp:ServerTag Property1="a" Property2="b" Property3="c" />

服务器端注释置于服务器端控件上方


  • 呈现的服务器控件内容


    cleaner剥离“
    感谢您对它必须是格式良好的XML的解释。了解“为什么”总是有帮助的。(正如我附带指出的,我同意jdk的评论,在这里使用服务器标记会更好。)
    
    <%-- Usage:
    Property2 is xyz... 
    Property3 will .. abc. Ignore Property  1 when this is set. etc
    --%>
    <asp:ServerTag Property1="a"
        Property2="b"
        Property3="c" 
        Property4="d" />