HtmlHelperLabelExtensions Class

Label-related extensions for Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper and Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper`1.

Namespace
Microsoft.AspNetCore.Mvc.Rendering
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public class HtmlHelperLabelExtensions
class Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperLabelExtensions

Methods

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

Returns a <label> element for the specified <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

public static IHtmlContent Label(this IHtmlHelper htmlHelper, string expression)
Label(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Returns a <label> element for the specified <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

public static IHtmlContent Label(this IHtmlHelper htmlHelper, string expression, string labelText)
LabelForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper)

Returns a <label> element for the current model.

Arguments:htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.
Return type:Microsoft.AspNetCore.Html.IHtmlContent
Returns:A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.
public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper)
LabelForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.Object)

Returns a <label> element for the current model.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper, object htmlAttributes)
LabelForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String)

Returns a <label> element for the current model.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper, string labelText)
LabelForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object)

Returns a <label> element for the current model.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

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

Returns a <label> element for the specified <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

public static IHtmlContent LabelFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)
LabelFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)

Returns a <label> element for the specified <em>expression</em>.

Arguments:
  • htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper`1 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.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

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

Returns a <label> element for the specified <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <label> element.

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