IHtmlHelper<TModel>.LabelFor<TResult> Method

Definition

Returns a <label> element for the specified expression.

public:
generic <typename TResult>
 Microsoft::AspNetCore::Html::IHtmlContent ^ LabelFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ labelText, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent LabelFor<TResult> (System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string labelText, object htmlAttributes);
abstract member LabelFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function LabelFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), labelText As String, htmlAttributes As Object) As IHtmlContent

Type Parameters

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

labelText
String

The inner text of the element.

htmlAttributes
Object

An Object that contains the HTML attributes for the element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

A new IHtmlContent containing the <label> element.

Applies to