我可以在ASP.NET中的标记内部添加注释吗? [英] Can I place a comment inside a tag in ASP.NET?
本文介绍了我可以在ASP.NET中的标记内部添加注释吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的aspx页面做这样的事情:
I want to do something like this in my aspx page:
<asp:ServerTag Property1="a"
Property2="b"
Property3="c" <%-- Comment why this particular property is necessary --%>
Property4="d" />
但是,我收到错误消息服务器标签不能包含<%...% >构造。如果我使用HTML<! - - >标签,我被告知服务器标签不好形成。
However, I am greeted with the error message "Server tags cannot contain <% ... %> constructs." If I use an HTML <!-- --> tag, I'm told the server tag is not well formed.
是否有其他语法可以实现这一点?
Is there any other syntax to make this possible?
推荐答案
这是不可能的,不。服务器标签需要是格式良好的XML,并且您不能在XML中具有类似的标签。您可以在顶部添加注释,当然,像这样:
It's not possible, no. The server tags need to be well-formed XML and you can't have tags like that in XML. You can put a comment at the top, of course, like so:
<!-- Property2 needed because... -->
<asp:ServerTag Property1="a" Property2="b" Property3="c" />
这篇关于我可以在ASP.NET中的标记内部添加注释吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文