Blog

Look at Razor

Posted by Sateesh Arveti Blogs | ASP.NET MVC with C# Aug 27, 2010
Razor is a new view engine available in upcoming ASP.NET MVC release.
The new view engine will reduce number of characters to code and easy to learn. Let's see few examples using Razor:


In earlier version for Code blocks:
Hi  <%= id %> (or) <%= DateTime.Now.Month %>

In Razor:
@id (or) @DateTime.Now.Month

In earlier version for for loops:
<% for(int i=0; i< 10; i++) { %>
<p><%= i %> </p>
<% } %>

In Razor:

@for(int i=0; i< 10;i++){
<p>@i</p>
}

@id (or) @DateTime.Now.Month

For more details, refer: http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
comments
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter