<% %>
- 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 "<%$
".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With