Archive for February, 2009

Maintaining ViewState on Password fields

just found this little nugget over on DotNetSlackers.com - By default dot net will activly stop you from maintaining the value in password text boxes on post back- which can be a pain in the ass forcing your user to keep retyping their password (twice as you will almost certainly have a password confirm box!).  You can get round this using this beauty;

Protected Sub txtMyPasswordField_PreRender( ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMyPasswordField.PreRender
    txtMyPasswordField.Attributes("value") = txtMyPasswordField.Text
End Sub

No Comments