Losing data in a textbox on postback

E

et

In a procedure where a user creates a password, among other things, the
password textbox returns to blank whenever a user selects other fields that
cause a postback, even though they are not done saving the record.. How can
I retain what the user has entered in the password field even on postback?
And why does it only happen to the password field; all other fields are
retained.
 
K

kailas.j.goliwadekar

Chk for enableviewstate property = true for the password textbox?
- Kailas
 
C

Christopher Reed

For security reasons, a password is not normally retained with a postback
because anyone will be able to see the password from the HTML source. Your
best option is to create a ViewState variable of your own and assign the
password to it on postback in most likely the Page_Load method. Then, in
the Page_PreRender method, reassign the password back to that particular
textbox.

Your truly best option is to collect all of the information first before you
have to postback. That way, you can process the password and forget about
it.

Hope this helps!
 
D

dew

I agree, that's probably the best idea, fill out everything else, then enter
the password. Thanks everyone!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top