Razor简单介绍


@{
    ViewData["Title"] = "Index";
    int sum = 1 + 1;
}

<h2>Index</h2>
<h1>sum is :@sum</h1>
<h1>ViewData["Title"]:@ViewData["Title"]</h1>
<h1>(1, 2)的最大值:@(Math.Max(1, 2))</h1>

<form method="post" action="/Bind/Index">
    <input type="text" name="id" id="id" value="2" />
    <input type="text" name="name" id="name" value="zs" />
    <input type="submit" value="submit" />
</form>
@Html.ActionLink("首页", "Index", "Home")
<a href="@Url.Action("Index","Home")">首页</a>

 

相关文章: