zoukankan      html  css  js  c++  java
  • Razor Intro

    http://www.w3schools.com/aspnet/razor_intro.asp

    Razor is not a programming language. It's a server side markup language.

    What is Razor?

    Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages.

    Server-based code can create dynamic web content on the fly, while a web page is written to the browser.

    When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser.

    By running on the server, the code can perform complex tasks, like accessing databases.

    Razor is based on ASP.NET, and designed for creating web applications.

    It has the power of traditional ASP.NET markup, but it is easier to use, and easier to learn.

    Razor Syntax

    Razor uses a syntax very 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 (and Classic ASP):

    <ul>
    <% for i = 0 to 10%>
    <li><% =i %></li>
    <% } %>
    </ul> 

    Razor Helpers

    ASP.NET helpers are components that can be accessed by single lines of Razor code.

    You can build your own helpers using Razor syntax, or use built-in ASP.NET helpers.

    Below is a short description of some useful Razor helpers:

    • Web Grid
    • Web Graphics
    • Google Analytics
    • Facebook Integration
    • Twitter Integration
    • Sending Email
    • Validation

    Razor Programming Languages

    Razor supports both C# (C sharp) and VB (Visual Basic).

  • 相关阅读:
    STL中string的源码解读
    Sublime插件:Terminal
    sublime text3安装Package Control
    [转]Sublime Text操作
    python itertools模块实现排列组合
    pandas 选择某几列
    更改pandas dataframe 列的顺序
    pandas之groupby分组与pivot_table透视表
    IPython notebook快捷键(Jupyter notebook)
    人生的意义
  • 原文地址:https://www.cnblogs.com/chucklu/p/5628982.html
Copyright © 2011-2022 走看看