Quantcast

ASP.NET Razor is a new syntax for writing ASP.NET web pages. In this tutorial you will learn how to add ASP.NET Razor code to web pages. Razor is a server side markup language. Razor code starts with @. Further, the code blocks of Razor are enclosed in braces and the code statements end with semicolon. Declaration of variables in Razor is done with the var keyword. An example covering the general syntax of single statement blocks, multi-statement blocks, and inline expressions of Razor is as follows:


In the above example, code beings with @ and variables are declared with var keyword, as required. Besides, strings are enclosed within the quotation marks.

Now let’s see the changes that are made within a simple HTML code to convert it into a Razor equipped code. Consider the following HTML code:

After adding the Razor part, the above code would become:

The page contains ordinary HTML markup, with one addition: the @ marked Razor code. The Razor code does all the work of determining the current time on the server and display it. So basically leaning the Razor syntax is quite simple but it is quite a powerful markup language that can considerably enhance the web development techniques.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
Admin
Admin
Ali has been an entrepreneur in web, video and related technologies. Having worked with many business across the globe, Ali stands truly a great pillar in the business working with him.