HtmlHelperValueExtensions.ValueFor(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) HtmlHelperValueExtensions.ValueFor(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) HtmlHelperValueExtensions.ValueFor(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) Method

Definition

Returns the formatted value for the specified expression. Specifically, returns the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".

public static string ValueFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression);
static member ValueFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> -> string
<Extension()>
Public Function ValueFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult))) As String

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

Returns

A String containing the formatted value.

Remarks

Converts the expression result to a String directly.

Applies to