Reputation: 558
What's better in ASP.NET MVC
<%= Html.LabelForModel() %>
or
<%: Html.LabelForModel() %>
? Why?
Upvotes: 4
Views: 677
Reputation: 1062580
If it returns MvcHtmlString it won't matter; the <%:
will know it is pre-escaped. I would therefore use <%:
as then the reviewer doesn't need to think "is this escaped? or is this a raw field?".
Of course, that does depend on the code that creates the MvcHtmlString being sane...
Upvotes: 5
Reputation: 24754
Neither is "better". They both output the same exact markup.
Upvotes: 0