How to keep the password in a password field when page post back?

  • Thread starter Thread starter feng
  • Start date Start date
F

feng

For a HTTP textbox with a Type of "password", the default
behaiver is that the field will be cleared out when the
page is posted back. This make sense in most of the cases.
But in some situation, it become problematic. In our
asp.net applicaiton, I would like to keep the password in
the field, if the page is posted back. Is this possible?
how?

Thanks
 
You could probably use client-side script to copy the field to a hidden
input control, then on page render, copy it back using Javascript. But why?

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
depending on implementation you can also use

if Page.IsPostBack then
myPasswordField.Text = "..."
end if
 
Well, I have a login page that has two tabs on it. There
are different passwrod fields on each tab. I know this
sounds strange but it is the business requirement of the
product. When use switch between tabs, a post back is
required. And that's where my problem comes.

When user fill out the password field on the first tab and
switch to the second tab, then if for some reson he wants
to go back to the first tab, geuss what, the password
field is cleard and he has to re-fill it again.

My client found this behaivor is confusing and
frustrating. They want me to keep the password in the
field after post back.

Thank you for your suggestion, but is there any way this
can be done from the server side? or using features of the
control itself?

Thanks
 
Back
Top