Dela via


HtmlHelperInputExtensions.PasswordFor<TModel,TResult> Method

Definition

Returns an <input> element of type "password" for the specified expression. Does not add a "value" attribute.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ PasswordFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression);
public static Microsoft.AspNetCore.Html.IHtmlContent PasswordFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression);
static member PasswordFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function PasswordFor(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.

Applies to