1. Different from ordinary HTML, the data inside the controller cannot be displayed in HTML in normal HTML.
In the MVC framework, it provides a view template (which combines common HTML tags with the ability to display data from the controller)
View Template properties: He has his own set of grammar rules to display the data
In the pages in ASP. <%%> format to embed the C # language
In the MVC framework, the view also needs to be embedded in the C # language, and after MVC3.0 the unification is the Razor View Engine (template), starting with the @ Sign C # language
2.Razor View Syntax
Start with the @ symbol, if it is a program code, then use {}, if you want to output a variable in front of the variable with an @ symbol,
Like what:
@{ int; @a }
3. In razor, the notation of the annotation, if in @{} single-line comment with//
4. In HTML or razor, multiple lines of comments are used @* *@ this method
5. How to embed HTML code in razor, when the need to introduce a variable is directly the @ variable name,
For example, the drop-down list box outputs 1-100 of the EMBED code:
<select> @{ for (int i=1; i<=; i++) { <option value="@i">@i</option> } } </Select>
6. About the escape of razor, such as in JavaScript, there is an @ symbol in the regular expression, this time with the @@ 符号 to escape,
For example: var s =/^\[email protected]@$/;
The niche just learns, if has the mistake, also please pointing.
2.MVC Framework Development (View development----BASIC syntax)