This section introduces you what is
Razor and Razor syntax.Razor is not a programming language. It is a server-side markup language.
Razor is a markup syntax that allows you to embed server-based code (Visual Basic and C#) into web pages.
Server-based code can create dynamic Web content as the web page is delivered to the browser. When a web page is requested, the server executes the server-based code in the page before returning the page to the browser. Run by the server, the code can perform complex tasks, such as accessing a database.
Razor is based on ASP.NET and is designed for creating Web applications. It has the functionality of traditional ASP.NET, but is easier to use and easier to learn.
Razor uses syntax similar to PHP and classic ASP.
Razor:
<ul> @for (int i = 0; i < 10; i++) { <li>@i</li> } </ul>
PHP:
<ul> <?php for ($i = 0; $i < 10; $i++) { echo("<li>$i</li>"); } ?> </ul>
Web Forms (Classic ASP):
<ul> <% for (int i = 0; i < 10; i++) { %> <li><% =i %></li> <% } %> </ul>
ASP.NET helpers are components that can be accessed with a few simple lines of Razor code.
You can build your own helper using Razor syntax, or use the built-in ASP.NET helper.
Here are brief descriptions of some useful Razor helpers:
Web Grid
Web Graphics
Google Analytics
Facebook Integration
Twitter Integration
Sending Email
Validation
Razor supports C# (C sharp) and VB (Visual Basic).