Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of what each of <% means (<%#, <%=, etc...) [duplicate]

Possible Duplicate:
ASP.NET “special” tags

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 ... %>.

like image 762
nikib3ro Avatar asked Jan 17 '11 20:01

nikib3ro


1 Answers

Here is a good place to get started.

There are several different syntaxes:

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

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 Encoded output
like image 63
Josiah Ruddell Avatar answered Sep 20 '22 13:09

Josiah Ruddell