Dela via


IHtmlHelper.Value(String, String) 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, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public:
 System::String ^ Value(System::String ^ expression, System::String ^ format);
public string Value (string expression, string format);
abstract member Value : string * string -> string
Public Function Value (expression As String, format As String) As String

Parameters

expression
String

Expression name, relative to the current model.

format
String

The format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to format the return value unless that came from model binding.

Returns

A String containing the formatted value.

Remarks

Converts the expression result to a String directly if format is null or empty.

Applies to