The PasswordBox control represents a text input control with password protection.
Use the PasswordBox.Text or PasswordBox.Value properties to get or set the control's text.
By using the MaxLength property you can specify the maximum number of chars allowed and by setting the AllowEmptyInput property you can define whether or not empty string values are considered valid for the control.
Adjust the interaction with the control by setting the SubmitOnEnter and AutoPostBack properties according to your needs.
By setting the EmptyText property you can display a hint to the user, and by setting the Label and LabelPosition properties you can specify a caption for the control.
The MaskChar allows custom characters to be used to hide the user's input. You can show or hide the reveal password button by setting the ShowButton property.
The following events are exposed by the PasswordBox class.
Event | Event arguments | Description |
---|---|---|
ValueChangedEventArgs<String> | Raised when the control's value has changed. |
You can access the control on the client side by its ClientID.
JavaScript
![]() |
---|
var passwordBox = $find("PasswordBox1"); |
Use the get_text and set_text or get_value and set_value methods to get or set the control's text.
JavaScript
![]() |
---|
passwordBox.set_text('test'); |
The following client-side events are exposed by the PasswordBox class.
Event | Event arguments | Script property | Description |
---|---|---|---|
Raised when a control's value is about to be changed. | |||
Raised when a control's value has changed. | |||
Raised when the control's value is validating. | |||
Raised when the control's input is invalid. | |||
Raised when the validation state of the control changes. | |||
- | Raised just after the control has finished loading and is ready for interaction. |