HtmlHelper.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".

C#
public string Value (string expression, string format);

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.

Implements

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0