What is the difference between <% %>
and <%= %>
in ASP.NET MVC? And when to use which?
See also this question. MVC hasn't changed how these bee-stings work, just how often they're used.
Basically:
<%
- execute code<%@
- page directive<%$
- resource access<%=
- explicit output to page<%#
- data binding<%--
- server side comment blockAlso new in ASP.Net 4:
<%:
- writes out to the page, but with HTML encodedIf 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