ASP.NET MVC Tags

I was looking through the NerdDinner source code, and ran across the <%: syntax in the views. I tried many different combinations of searching through Google and Stackoverflow, but I couldn’t find anything. I finally found the answer accidently while reading Phil Haack’s blog post. I kept trying to search for tags (including the words percent and colon) and the like, but it looks like Microsoft references them as a code block or code nugget.

This is to replace or supersede the <%= syntax. More specifically it is to alleviate some of the repetitive typing of <%= Html.Encode as is typically seen through ASP.NET MVC apps.

Please refer back to Phil’s post on more information about this topic, this is something more people need to be aware of and using through their MVC2 apps (only for ASP.NET 4).

Related Posts