Share via


HtmlHelperValueExtensions.ValueForModel Method

Definition

Overloads

ValueForModel(IHtmlHelper)

Returns the formatted value for the current model. Specifically, returns the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the Model. See Name(String) for more information about a "full name".

ValueForModel(IHtmlHelper, String)

Returns the formatted value for the current model. Specifically, returns the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the Model. See Name(String) for more information about a "full name".

ValueForModel(IHtmlHelper)

Source:
HtmlHelperValueExtensions.cs
Source:
HtmlHelperValueExtensions.cs
Source:
HtmlHelperValueExtensions.cs

Returns the formatted value for the current model. Specifically, returns the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the Model. See Name(String) for more information about a "full name".

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ ValueForModel(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper);
public static string ValueForModel (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper);
static member ValueForModel : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper -> string
<Extension()>
Public Function ValueForModel (htmlHelper As IHtmlHelper) As String

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

Returns

A String containing the formatted value.

Remarks

Converts the model value to a String directly.

Applies to

ValueForModel(IHtmlHelper, String)

Source:
HtmlHelperValueExtensions.cs
Source:
HtmlHelperValueExtensions.cs
Source:
HtmlHelperValueExtensions.cs

Returns the formatted value for the current model. Specifically, returns the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the Model. See Name(String) for more information about a "full name".

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ ValueForModel(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ format);
public static string ValueForModel (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string format);
static member ValueForModel : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string -> string
<Extension()>
Public Function ValueForModel (htmlHelper As IHtmlHelper, format As String) As String

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

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 model value to a String directly if format is null or empty.

Applies to