<! DOCTYPE html>
The page contains normal HTML markup, and in addition to this, an @ ID Razor code is added.
The Razor code can perform many actions in real time on the server and display the results. (You can specify formatting options, otherwise only the default items are displayed.) )
The main Razor C # syntax rules
Razor code block included in @{...}
inline expressions (variables and functions) begin with @
The code statement ends with a semicolon
Variables declared with the VAR keyword
The string is enclosed in quotation marks.
C # code is case-sensitive
C # files have the. cshtml extension.
C # instances
<!--single statement block-->@{var mymessage = "Hello World";} <!--Inline expression or variable--><p>the value of Mymessage is: @myMessage </p> <!--multi-stateme NT Block-->@{var greeting = "Welcome to our site!"; var WeekDay = Datetime.now.dayofweek;var GreetingMessage = greeting + "Today is:" + WeekDay;} <p>the greeting is: @greetingMessage </p>
The main Razor VB grammar rules
The Razor code block is included in the @Code ... End Code in
inline expressions (variables and functions) begin with @
Variables declared with the DIM keyword
The string is enclosed in quotation marks.
VB code is case insensitive
The VB file extension is. vbhtml
Instance
<!--single statement block-to @Code Dim mymessage = "Hello World" End code<!--Inline expression or variable-- > <p>the value of mymessage is: @myMessage </p> <!--multi-statement block-to-@Codedim greeting = "We Lcome to our site! "Dim WeekDay = DateTime.Now.DayOfWeek Dim GreetingMessage = Greeting &" Today is: "& Weekdaye nd Code <p>the greeting is: @greetingMessage </p>
"Recommended"
1. ASP. NET free Video Tutorials
2. Share the ASP.--webpages Introduction
4. What is ASP. NET MVC? Summarizing ASP. NET MVC
5. Learn more about the difference between ASP. NET MVC and WebForm