Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
ASP.NET: Maintain an entered password in a TextBox
Summary: When a postback occurs, any TextBoxes which have their TextMode set to Password will be cleared and the user will have to retype their password. Here is a workaround.
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- If Page.IsPostBack Then
- TextBox1.Attributes.Add("value", TextBox1.Text)
- End If
- End Sub
This Hack is part of the ASP.NET Hacks collection