You know how you can embed property value from code-behind in your page by simply using <%= PropertyFromCodeBehind %> in your .aspx?
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.
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 ... %>.
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 <%= %>.
发布评论
评论(2)
这里是一个很好的开始的地方。
有几种不同的语法:
<%$ %>
表达式语法<%# %>
数据绑定语法<% %>
计算代码块<%= %>
语句和表达式 >ASP.NET 4 的新增功能是 HTML 编码语法 (被黑客攻击)。这与
<%= %>
相同,只是结果是 HTML 编码的(对于非IHtmlString
类型)。新语法旨在取代<%= %>
。<%: %>
HTML 编码输出Here is a good place to get started.
There are several different syntaxes:
<%$ %>
Expression Syntax<%# %>
Data-Binding syntax<% %>
Evaluated Code Blocks<%= %>
Statement and ExpressionNew to ASP.NET 4 is the HTML encoding syntax (haacked). This is the same as
<%= %>
except the result is HTML encoded (for nonIHtmlString
types). The new syntax is intended to replace<%= %>
.<%: %>
HTML Encoded output请参阅ScottGU 的帖子 可以帮助您入门。
See ScottGU's post post to get you started.