Share via


IHtmlHelper<TModel>.PasswordFor<TResult> Method

Definition

Returns an <input> element of type "password" for the specified expression. Adds a "value" attribute containing the htmlAttributes dictionary entry with key "value" (if any).

public:
generic <typename TResult>
 Microsoft::AspNetCore::Html::IHtmlContent ^ PasswordFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent PasswordFor<TResult> (System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, object htmlAttributes);
abstract member PasswordFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function PasswordFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), htmlAttributes As Object) As IHtmlContent

Type Parameters

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

htmlAttributes
Object

An Object that contains the HTML attributes for the element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

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