What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?
What is the difference between <% %> and <%= %> in ASP.NET MVC? And
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 encoded