列出每个<%的含义(<%#,<%=等)。 [英] List of what each of <% means (<%#, <%=, etc...)

查看:79
本文介绍了列出每个<%的含义(<%#,<%=等)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

ASP.NET特殊标签

您知道如何从代码隐藏中嵌入属性值只需在您的.aspx中使用<%= PropertyFromCodeBehind%>来创建页面?

You know how you can embed property value from code-behind in your page by simply using <%= PropertyFromCodeBehind %> in your .aspx?

好吧,我最近才发现这一点,而且我似乎找不到任何可以进一步解释(及相关内容)(我只知道<%#与Eval结合使用)-可能是因为我在搜索中使用<%。

Well, I only recently discovered that and I can't seem to find any tutorial that would explain this (and related stuff) in more depth (I only know that <%# is used in conjuction with Eval) - probably because I'm using <% for searches.

那么,有人可以为我提供这些标签的更多详细说明,还是提供指向说明所有这些内容的教程的链接?我对可以在该主题上学到的任何东西都感兴趣;在某处,我看到您可以执行<%for ...%>之类的东西。

So, can anybody provide me with more detail explanation of these tags, or give a link to some tutorial that explains all this? I'm interested in anything that can be learned on this subject; somewhere I saw that you can do fancy stuff like <% for ... %>.

推荐答案

此处是入门的好地方。

有几种不同的语法:


  • <%$%> 表达式语法

  • <%#%> 数据绑定语法

  • <%%> 评估的代码块

  • <%=%> 语句和表达式

  • <%$ %> Expression Syntax
  • <%# %> Data-Binding syntax
  • <% %> Evaluated Code Blocks
  • <%= %> Statement and Expression

ASP.NET 4的新功能是 HTML编码语法(已启用)。这与<%=%> 相同,除了结果是HTML编码的(对于非 IHtmlString 类型) 。新语法旨在替换<%=%>

New to ASP.NET 4 is the HTML encoding syntax (haacked). This is the same as <%= %> except the result is HTML encoded (for non IHtmlString types). The new syntax is intended to replace <%= %>.


  • <%:%> HTML编码输出

  • <%: %> HTML Encoded output

这篇关于列出每个&lt;%的含义(&lt;%#,&lt;%=等)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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