我希望在我的.aspx页面中显示这个,而不使用特殊的字符XML标签,这可以实现吗?
<asp:ServerTag Property1="a"
Property2="b"
Property3="c" <%-- Comment why this particular property is necessary --%>
Property4="d" />
Run Code Online (Sandbox Code Playgroud)
但是,我Server tags cannot contain <% ... %> constructs.遇到了错误消息如果我使用HTML <! - - >标签,我被告知服务器标签格式不正确.
有没有其他语法可以实现这一点?
Joh*_*n K 11
将服务器端注释放在服务器端控件上方.
<!-- 客户端评论(html) - 出现在html源代码中但未在页面上呈现<%-- 服务器端评论 - 在服务器上剥离,从未见过光,浏览器从未知道它像这样
<%-- 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" />
Run Code Online (Sandbox Code Playgroud)
这就像把源代码注释放在你的函数之上.
想想"服务器到服务器".它将使你的HTML源代码看起来像"通过"html评论
混乱<!--:
<! - 属性用法:abc,def,... xyz - >
呈现的服务器控件内容.
与清洁工剥离" <%--来源:
呈现的服务器控件内容.
后者的带宽也减少了.在HTML源代码中没有无关(并且混淆用户)注释.
Dea*_*ing 10
这是不可能的,不.服务器标签需要是格式良好的XML,并且您不能在XML中使用这样的标签.当然,您可以在顶部发表评论,如下所示:
<!-- Property2 needed because... -->
<asp:ServerTag Property1="a" Property2="b" Property3="c" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10812 次 |
| 最近记录: |