点关注不迷路

Max

MVC杂记

@{ Layout = “…”}

To define layout page Equivalent to asp.NET master-page

要定义相当于ASP.Net母版页的页面布局

@model <StrongModelType>

To define strongly-typed model

要定义强类型的模型

@section <name> { }

To define named section

定义命名节

@RenderBody

Used in layout as a placeholder for view’s entire content.

用于布局视图的整个内容的占位符。

@RenderPage

Renders the content of one page within another page.

将内容呈现在一个页面内的另一页。

@RenderSection

In layout pages, renders the content of a named section.

在布局页面,呈现的内容已命名的节。

IsSectionDefined

Returns a value that indicates whether the specified section is defined in the page.

返回一个值,指示是否定义在页面中指定的部分。

DefineSection

To create named content sections in content page.

创建命名在内容页的内容部分。

@helper

To define a helper which create a reusable code snippet.

要定义一个帮手创建一个可重用的代码片段。

@functions

To define a function ( pure server-side methods)that can be reused within the view.

要定义一个视图内,可重复使用的功能(纯服务器端方法)。

@ViewBag.<myData>

Dynamic property, used to pass data between a Controller and a View

用于控制器和视图之间传递数据的动态特性

@ViewData[myData]

To pass data between a Controller and a View via special Dictionary class

通过特殊的Dictionary类的一个控制器和视图之间传递数据

@tempdata

To pass State Between Action Methods

要传递操作方法之间的状态

ActionFilterAttribute

Represents the base class for filter attributes.

代表筛选器属性的基类。

ActionMethodSelectorAttribute

Represents an attribute that is used to influence the selection of an action method.

表示一个特性,用于一个操作方法的选择产生影响。

ActionNameSelectorAttribute

Represents an attribute that affects the selection of an action method.

表示一个特性,影响一个操作方法的选择。

CustomModelBinderAttribute

It invokes a custom model binder.

它调用自定义模型绑定者。

FilterAttribute

base class for action and result filter attributes.

行动和结果筛选器特性的基类。

Html.ActionLink

输出: <a href=”..”…>..</a>

Html.BeginForm

输出: <form …>

Html.CheckBox

输出: <input type="checkbox" …/>

Html.DropDownList

输出: <select ..> .. </select>

Html.EndForm

输出: </form>

Html.Hidden

输出: <input type="hidden" ... />

Html.ListBox

输出: <select multiple …>…</select>

Html.Password

输出: <input type="password" … />

Html.RadioButton

输出: <input type="radio" .. />

Html.TextArea

输出: <textarea…>…</textarea>

Html.TextBox

输出: <input type="text" … />

Html.ValidationSummary

Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object.

返回一个在ModelStateDictionary对象中的无序列表(ul元素)的验证消息。

Html.ValidationMessage

To display an error for a particular field in the ModelState dictionary

要显示一个错误的ModelState字典中的特定字段

Html.RouteLink

To generate a URL to a specific route

要生成一个URL到一个特定的路由

@Html.AntiForgeryToken

It generates a hidden form field (anti-forgery token) that is validated when the form is submitted.

它会产生一个隐藏的表单字段(防伪标记),提交表单时验证。

@Html.AttributeEncode

To convert the specified attribute value to an HTML-encoded string.

HTML编码的字符串转换成指定的属性值。

@Html.Encode

To convert the specified value to an HTML-encoded string.

HTML编码的字符串转换为指定的值。

@{ Html.EnableClientValidation(); }

To enables or disables client validation

要启用或禁用客户端验证

Html. EnableUnobtrusiveJavaScript

To enables or disables unobtrusive JavaScript.

要启用或禁用不显眼的JavaScript。

@Html.FormatValue

To format value

要格式化值

@Html.Raw

To return markup that is not HTML encoded.

要返回标记并非HTML编码。

@Html.Partial

To render a partial view into a string.

要渲染成一个字符串的局部视图。

@{Html.RenderPartial(..);}

writes directly to the response output stream instead of returning a string.

直接写入到响应输出流,而不是返回一个字符串。

@Html.Action

executes a separate controller action and returns as string

执行一个单独的控制器操作并返回作为字符串

Html.RenderAction

executes a separate controller action and render the result directly to the Response

执行一个单独的控制器动作,并呈现结果直接响应

posted @ 2017-05-09 13:20  Max麦克斯  阅读(190)  评论(0编辑  收藏  举报