Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图对上述查询进行搜索,但可能由于尖括号,我没有找到任何关于此事的内容。
谁能解释一下 , 之间有什么<%=区别 <%: <%#?
<%=
<%:
<%#
我似乎记得那<%#是首选,<%=但我不知道为什么。
<%= xxx %>将 xxx 中的文本插入到该位置的页面中。(更多信息)
<%= xxx %>
<%: xxx %>与上面相同,只是它为方便起见对文本进行了 html 编码 - (除非 xxx 是一个 HtmlString 表示它已经编码)
<%: xxx %>
<%# xxx %>与第一个相同,除了 xxx 仅在表单上调用 DataBind() 时评估(在 MVC 中并不真正适用)(更多信息)
<%# xxx %>
马丁
下面的文章很好地描述了它们。
<%: %>
<%# %>