Table of Contents

Class DisplayNameExtensions

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

Provides a mechanism to get display names.

public static class DisplayNameExtensions
Inheritance
DisplayNameExtensions
Inherited Members

Methods

DisplayName(HtmlHelper, string)

Gets the display name.

public static MvcHtmlString DisplayName(this HtmlHelper html, string expression)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the object that contains the display name.

Returns

MvcHtmlString

The display name.

DisplayNameForModel(HtmlHelper)

Gets the display name for the model.

public static MvcHtmlString DisplayNameForModel(this HtmlHelper html)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

Returns

MvcHtmlString

The display name for the model.

DisplayNameFor<TModel, TValue>(HtmlHelper<IEnumerable<TModel>>, Expression<Func<TModel, TValue>>)

Gets the display name for the model.

public static MvcHtmlString DisplayNameFor<TModel, TValue>(this HtmlHelper<IEnumerable<TModel>> html, Expression<Func<TModel, TValue>> expression)

Parameters

html HtmlHelper<IEnumerable<TModel>>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the object that contains the display name.

Returns

MvcHtmlString

The display name for the model.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.

DisplayNameFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>)

Gets the display name for the model.

public static MvcHtmlString DisplayNameFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the object that contains the display name.

Returns

MvcHtmlString

The display name for the model.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.