Dela via


HtmlHelperValueExtensions.Value(IHtmlHelper, 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::Runtime::CompilerServices::Extension]
 static System::String ^ Value(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression);
public static string Value (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression);
static member Value : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string -> string
<Extension()>
Public Function Value (htmlHelper As IHtmlHelper, expression As String) As String

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

Returns

A String containing the formatted value.

Remarks

Converts the expression result to a String directly.

Applies to