Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<%$, <%@, <%=, <%# ... what's the deal?

  • <% %> - is for inline code (especially logic flow)
  • <%$ %> - is for evaluating expressions (like resource variables)
  • <%@ %> - is for Page directives, registering assemblies, importing namespaces, etc.
  • <%= %> - is short-hand for Response.Write (discussed here)
  • <%# %> - is used for data binding expressions.
  • <%: %> - is short-hand for Response.Write(Server.HTMLEncode()) ASP.net 4.0+
  • <%#: %> - is used for data binding expressions and is automatically HTMLEncoded.
  • <%-- --%> - is for server-side comments

You've covered 2 of them (<%# is evaluated only at databind, and <%= is evaluated at render), and the answer for "<%@" is that it's compiler directives (ie., stuff like what you'd put on a compiler's command line).

I don't know about "<%$".