# ASP.NET ..Dropdownlist & Password fields



## Prashanti (Apr 24, 2006)

Hi!

I am developing a web page using asp.net . It has 2 HTML text ctrls, 2 HTML password ctrls(password & confirm password), 6 dropdownlists(ddls) and 3 HTML buttons . 

It is an entry screen for users to enter info into the db or to view records stored in it .

Based on the option selected in the 1st ddl the 2nd ddl should get populated from the db . Based on the value selected in the 2nd ddl the values should be populated in the 3rd ddl and so on . 

When the Save button is pressed , the form should be submitted . 
When the Search buttton is pressed , it should retrieve the record from the db and display . So far it works . 

While searching however the password field value is not displayed even though the remaining values are shown . WHY?????

Also , while entering a new record , when the page is submitted during autopostback , the values entered in the text and password fields also get submitted before the entire form has been filled . That is, Search is performed during autopostback . 
How to preserve the values in the remaining fields even during a postback ?
Also , the users should be able to navigate from one ctrl to another using enter key without the page getting submitted every time the user presses enter key . 
How to handle this ???


A very big request , I know , but any help would be very much appreciated !!!
Please Help!!!!
--------------------------------------------------------------------------------------
Somebody , somewhere has already found the answer . Its just a matter of finding out who it was and how they solved it !!!


----------



## Maarten Huybrigh (Oct 4, 2007)

You can show the value in the password field by using a "value" attribute.

txtPassword.Text = oUser.password;
txtPassword.Attributes.Add("value",oUser.password);

However, do be aware that this is unsecure.
If a user views the generated HTML code in his browser, he will be able to see this value in clear text!


----------

