Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

ASP.NET: Maintain an entered password in a TextBox

From Wiki

Jump to: navigation, search

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.

  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.     If Page.IsPostBack Then
  3.         TextBox1.Attributes.Add("value", TextBox1.Text)
  4.     End If
  5. End Sub

This Hack is part of the ASP.NET Hacks collection

434 Rating: 1.0/5 (1 vote cast)