HtmlHelperValueExtensions.ValueForModel HtmlHelperValueExtensions.ValueForModel HtmlHelperValueExtensions.ValueForModel Method

Definition

Overloads

ValueForModel(IHtmlHelper) ValueForModel(IHtmlHelper) 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) ValueForModel(IHtmlHelper, String) 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) ValueForModel(IHtmlHelper) 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".

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 IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

Returns

A String containing the formatted value.

Remarks

Converts the model value to a String directly.

ValueForModel(IHtmlHelper, String) ValueForModel(IHtmlHelper, String) 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".

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 IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

format
String String 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