System.Web.UI.HtmlControls.HtmlInputPassword Class

Allows programmatic access to the HTML <input type= password> element on the server.

See Also: HtmlInputPassword Members


public class HtmlInputPassword : HtmlInputText


The System.Web.UI.HtmlControls.HtmlInputPassword class is derived from the System.Web.UI.HtmlControls.HtmlInputText class and is used to create a single-line text box that allows the user to enter a password. When using the System.Web.UI.HtmlControls.HtmlInputPassword control, the HtmlInputText.Value property is posted to the server each time the form is submitted. The HtmlInputText.Value property for the System.Web.UI.HtmlControls.HtmlInputPassword control is not persisted in view state.

The HtmlInputText.MaxLength property specifies the maximum number of characters that can be entered in the text box. The HtmlInputText.Size property allows you to specify the width of the text box. Use the HtmlInputText.Value property to determine the value entered in the text box by the user. The System.Web.UI.HtmlControls.HtmlInputPassword control provides a HtmlInputText.ServerChange event that is raised when the HtmlInputText.Value property changes values between posts to the server. This allows you to create an event handler that performs a custom set of instructions each time the event is raised.


The System.Web.UI.HtmlControls.HtmlInputPassword control does not provide a built-in way to post back to the server. You must provide another control on the Web page that supports posting back to the server, such as an System.Web.UI.HtmlControls.HtmlButton or an System.Web.UI.HtmlControls.HtmlInputSubmit control.

For a list of initial property values for an instance of System.Web.UI.HtmlControls.HtmlInputPassword, see the HtmlInputPassword.#ctor constructor.


Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0