HtmlHelperLabelExtensions Class

Summary

Label-related extensions for [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml).

Syntax

public class HtmlHelperLabelExtensions

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.Rendering.HtmlHelperLabelExtensions

Methods

Label(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String)

Returns a &lt;label&gt; element for the specified <paramref name=”expression” />.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • expression (System.String) – Expression name, relative to the current model.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString Label(IHtmlHelper htmlHelper, string expression)
Label(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Returns a &lt;label&gt; element for the specified <paramref name=”expression” />.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • expression (System.String) – Expression name, relative to the current model.
  • labelText (System.String) – The inner text of the element.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString Label(IHtmlHelper htmlHelper, string expression, string labelText)
LabelForModel(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper)

Returns a &lt;label&gt; element for the current model.

Arguments:
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelForModel(IHtmlHelper htmlHelper)
LabelForModel(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Object)

Returns a &lt;label&gt; element for the current model.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelForModel(IHtmlHelper htmlHelper, object htmlAttributes)
LabelForModel(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String)

Returns a &lt;label&gt; element for the current model.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • labelText (System.String) – The inner text of the element.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelForModel(IHtmlHelper htmlHelper, string labelText)
LabelForModel(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object)

Returns a &lt;label&gt; element for the current model.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
  • labelText (System.String) – The inner text of the element.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelForModel(IHtmlHelper htmlHelper, string labelText, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelperLabelExtensions.LabelFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)

Returns a &lt;label&gt; element for the specified <paramref name=”expression” />.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) instance this method extends.
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelperLabelExtensions.LabelFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)

Returns a &lt;label&gt; element for the specified <paramref name=”expression” />.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) instance this method extends.
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
  • htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelperLabelExtensions.LabelFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)

Returns a &lt;label&gt; element for the specified <paramref name=”expression” />.

Arguments:
  • htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) instance this method extends.
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
  • labelText (System.String) – The inner text of the element.
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

Returns:

A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the &lt;label&gt; element.

public static HtmlString LabelFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string labelText)