IHtmlHelper.Password(String, Object, Object) Method

Definition

Returns an <input> element of type "password" for the specified expression. Adds a "value" attribute containing the first non-null value in: the value parameter, or the htmlAttributes dictionary entry with key "value".

C#
public Microsoft.AspNetCore.Html.IHtmlContent Password (string expression, object value, object htmlAttributes);

Parameters

expression
String

Expression name, relative to the current model.

value
Object

If non-null, value to include in the element.

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 expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0