Table of Contents

Class LabelExtensions

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

Represents support for the HTML label element in an ASP.NET MVC view.

public static class LabelExtensions
Inheritance
LabelExtensions
Inherited Members

Methods

Label(HtmlHelper, string)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

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

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Label(HtmlHelper, string, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString Label(this HtmlHelper html, string expression, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Label(HtmlHelper, string, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString Label(this HtmlHelper html, string expression, object htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Label(HtmlHelper, string, string)

Returns an HTML label element and the property name of the property that is represented by the specified expression using the label text.

public static MvcHtmlString Label(this HtmlHelper html, string expression, string labelText)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

labelText string

The label text to display.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Label(HtmlHelper, string, string, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString Label(this HtmlHelper html, string expression, string labelText, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

labelText string

The label text.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Label(HtmlHelper, string, string, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString Label(this HtmlHelper html, string expression, string labelText, object htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

expression string

An expression that identifies the property to display.

labelText string

The label text.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

LabelForModel(HtmlHelper)

Returns an HTML label element and the property name of the property that is represented by the model.

public static MvcHtmlString LabelForModel(this HtmlHelper html)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the model.

LabelForModel(HtmlHelper, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelForModel(this HtmlHelper html, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

LabelForModel(HtmlHelper, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelForModel(this HtmlHelper html, object htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

LabelForModel(HtmlHelper, string)

Returns an HTML label element and the property name of the property that is represented by the specified expression using the label text.

public static MvcHtmlString LabelForModel(this HtmlHelper html, string labelText)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

labelText string

The label text to display.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

LabelForModel(HtmlHelper, string, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelForModel(this HtmlHelper html, string labelText, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

labelText string

The label Text.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

LabelForModel(HtmlHelper, string, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelForModel(this HtmlHelper html, string labelText, object htmlAttributes)

Parameters

html HtmlHelper

The HTML helper instance that this method extends.

labelText string

The label text.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

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

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelFor<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 property to display.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.

LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the property to display.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.

LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

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

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the property to display.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The value.

LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, string)

Returns an HTML label element and the property name of the property that is represented by the specified expression using the label text.

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

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the property to display.

labelText string

The label text to display.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.

LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, string, IDictionary<string, object>)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string labelText, IDictionary<string, object> htmlAttributes)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the property to display.

labelText string

The label text to display.

htmlAttributes IDictionary<string, object>

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The type of the value.

LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, string, object)

Returns an HTML label element and the property name of the property that is represented by the specified expression.

public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string labelText, object htmlAttributes)

Parameters

html HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression Expression<Func<TModel, TValue>>

An expression that identifies the property to display.

labelText string

The label text.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

MvcHtmlString

An HTML label element and the property name of the property that is represented by the expression.

Type Parameters

TModel

The type of the model.

TValue

The Value.