在ASP.Net,之间有什么&LT的差异;%和&lt =;%# [英] In ASP.Net, what is the difference between <%= and <%#

查看:82
本文介绍了在ASP.Net,之间有什么&LT的差异;%和&lt =;%#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.Net,之间有什么区别<%= X%GT; <%#X%>

In ASP.Net, what is the difference between <%= x %> and <%# x %>?

推荐答案

请参阅这个问题:结果
什么时候应该使用#和=在ASP.NET控件<? / A>

See this question:
When should I use # and = in ASP.NET controls?

从这些答案总结:

有一个几个不同的蜂螫


  • &LT;%@ - 页/控制/导入/注册的指令

  • &LT;%$ - 资源访问和前pression 建设

  • &LT;%= - 显式输出到页面,相当于&LT;%的Response.Write()%&GT;

  • &LT;%# - 数据绑定。 的只能用在支持数据绑定,或者如果你调用的Page.DataBind()在code-背后的页面级别。

  • &LT;% - - 服务器端注释块

  • &LT;%: - 相当于&LT;%= ,但<一个href=\"http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx\">also HTML-CN codeS输出。

  • <%@ - Page/Control/Import/Register directive
  • <%$ - Resource access and Expression building
  • <%= - Explicit output to page, equivalent to <% Response.Write( ) %>
  • <%# - Data Binding. It can only used where databinding is supported, or at the page level if you call Page.DataBind() in your code-behind.
  • <%-- - Server-side comment block
  • <%: - Equivalent to <%=, but it also html-encodes the output.

这篇关于在ASP.Net,之间有什么&LT的差异;%和&lt =;%#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆