Reputation: 671
I'm working on an MVC project without Razor. Therefore Html helpers are wrapped in <% and %>.
My question is what are the differences between <%= and <%: ?
Upvotes: 1
Views: 109
Reputation: 10078
<%= creates html markup - renders html elements in page <%: encodes as display text on page
So, if you put a anchor inside <%:this%> you'll see the raw markup in your page rather than a link. And by the way, in Razor, why not use @ instead of <%=
e.g. the following code produces the page below
<div>
<%= "<a href='#'>test</a>" %>
<%: "<a href='#'>test</a>" %>
</div>
Upvotes: 3