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

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
 
E

Eric Lawrence [MSFT]

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.
 
G

Guest

depending on implementation you can also use

if Page.IsPostBack then
myPasswordField.Text = "..."
end if
 
F

feng

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top