HtmlHelperInputExtensions.HiddenFor<TModel,TResult> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an <input> element of type "hidden" for the specified expression
. Adds a
"value" attribute to the element containing the first non-null
value found in:
the ModelState entry with full name, or
the expression
evaluated against Model.
See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".
public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Html::IHtmlContent ^ HiddenFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression);
public static Microsoft.AspNetCore.Html.IHtmlContent HiddenFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression);
static member HiddenFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function HiddenFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult))) As IHtmlContent
Type Parameters
- TModel
The type of the model.
- TResult
The type of the expression
result.
Parameters
- htmlHelper
- IHtmlHelper<TModel>
The IHtmlHelper<TModel> instance this method extends.
- expression
- Expression<Func<TModel,TResult>>
An expression to be evaluated against the current model.
Returns
A new IHtmlContent containing the <input> element.
Remarks
Combines HtmlFieldPrefix and the string representation of the expression
to set <input> element's "name" attribute. Sanitizes the string representation of the expression
to set element's "id" attribute.