ASP. NET MVC Razor View syntax

Source: Internet
Author: User

ASP. NET MVC Razor View Syntax

[email protected] symbol OUTPUT variable value

2. Use the C # syntax to nest HTML tags to loop output namelist values: Use @{c# syntax code}:

3. Output @ symbol using two @@

4. Server annotations Use @* comment content *@

[Email protected]: output text, or use <text></text>

6. Perform simple operations or operations at @ () brackets

[Email protected] () or @{} can output a string with HTML tags

8.Razor can be used to intelligently identify mailbox wording

9. Type Conversion

10. Embed (load) a sub-page (or other page) on the page

11. Layout (Master page)

@RenderBody (): This method loads the contents of a child page in the master page and then consolidates the rendering.

@RenderSection (name, whether the child page must be implemented)

[Email protected]

Create the App_Code folder under the root directory and write the @helper method to the xx.cshtml in this folder, and you can use it globally.

To use on other pages:


ASP. NET MVC Razor View syntax

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.