Table of Contents

Class NameExtensions

Namespace
System.Web.Mvc.Html
Assembly
System.Web.Mvc.dll

Gets the HTML ID and name attributes of the HtmlHelper string.

public static class NameExtensions
Inheritance
NameExtensions
Inherited Members

Methods

Id(HtmlHelper, string)

Gets the ID of the HtmlHelper string.

public static MvcHtmlString Id(this HtmlHelper html, string name)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

name string

An expression that identifies the object that contains the ID.

Returns

MvcHtmlString

The HTML ID attribute value for the object that is represented by the expression.

IdForModel(HtmlHelper)

Gets the ID of the HtmlHelper string.

public static MvcHtmlString IdForModel(this HtmlHelper html)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

Returns

MvcHtmlString

The HTML ID attribute value for the object that is represented by the expression.

IdFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)

Gets the ID of the HtmlHelper<TModel> string

public static MvcHtmlString IdFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TProperty>>

An expression that identifies the object that contains the ID.

Returns

MvcHtmlString

The HTML ID attribute value for the object that is represented by the expression.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Name(HtmlHelper, string)

Gets the full HTML field name for the object that is represented by the expression.

public static MvcHtmlString Name(this HtmlHelper html, string name)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

name string

An expression that identifies the object that contains the name.

Returns

MvcHtmlString

The full HTML field name for the object that is represented by the expression.

NameForModel(HtmlHelper)

Gets the full HTML field name for the object that is represented by the expression.

public static MvcHtmlString NameForModel(this HtmlHelper html)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

Returns

MvcHtmlString

The full HTML field name for the object that is represented by the expression.

NameFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)

Gets the full HTML field name for the object that is represented by the expression.

public static MvcHtmlString NameFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TProperty>>

An expression that identifies the object that contains the name.

Returns

MvcHtmlString

The full HTML field name for the object that is represented by the expression.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.