IHtmlHelper<TModel>.ValueFor<TResult> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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:
generic <typename TResult>
System::String ^ ValueFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ format);
public string ValueFor<TResult>(System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string format);
abstract member ValueFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string -> string
Public Function ValueFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), format As String) As String
Type Parameters
- TResult
The type of the expression result.
Parameters
- expression
- Expression<Func<TModel,TResult>>
An expression to be evaluated against the current model.
- format
- String
The format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to format the
expression value when returning that value.
Returns
A String containing the formatted value.
Remarks
Converts the expression result to a String directly if format is null or empty.