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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - expression (System.String) – Expression name, relative to the current model.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the <label> element.public static IHtmlContent Label(this IHtmlHelper htmlHelper, string expression)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
Label
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns a <label> element for the specified <em>expression</em>.
Arguments: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
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: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the <label> element.public static IHtmlContent Label(this IHtmlHelper htmlHelper, string expression, string labelText)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the <label> element.public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper, object htmlAttributes)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
LabelForModel
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String) 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. - labelText (System.String) – The inner text of the element.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the <label> element.public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper, string labelText)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
LabelForModel
(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object) 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. - labelText (System.String) – The inner text of the element.
- htmlAttributes (System.Object) – An
System.Object
that contains the HTML attributes for the element. Alternatively, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the <label> element.public static IHtmlContent LabelForModel(this IHtmlHelper htmlHelper, string labelText, object htmlAttributes)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - 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.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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, anSystem.Collections.Generic.IDictionary`2
instance containing the HTML attributes.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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: - 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.
- labelText (System.String) – The inner text of the element.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-