Represents an input form control for passwords.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[ValidationPropertyAttribute("Password")] [AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] public class PasswordTextBox : WebControl, IPostBackDataHandler
This control can be used in one of two modes:
Entering a password for the first time
Editing a previously stored password
In the first case, the control will display an empty password field. The user can supply a value or leave the field empty. In either case, the first postback will raise the PasswordChanged event.
In the second case, the user will be "editing" a previously saved password. In this mode, the control will display eight asterisks to show the user that a previously saved value exists. If the user does not change this value then the PasswordChanged event will not be raised and the PasswordWasChanged property will be false.
There are two postback and redraw scenarios. The first is when the user was in the "edit a previously saved password" mode and they did not alter the password value. In this case, the eight asterisks were uploaded as the user's input. The control will render another eight asterisks on the redraw.
The second redraw scenario is when the user supplied a password to this form. It may have been specified just now on this postback or it may have been specified on a previous postback. In either case, the control will still draw asterisks in the input control. The user-supplied password is never displayed. In this case, the number of fake asterisks that is used is the same number as the number of characters in the user-supplied password.