TextBox Password Mode

I have a textbox that is pulling in the password from the database

However...
When I have txtPassword.TextMode = TextBoxMode.Password
txtPassword.Text = dr("Decrypted") shows nothing

When I change the mode to remove the password mode the textbox populates.
Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Om PrakashCommented:
What is the use of reading password from DB and assigning to textbox? What user will see is nothing.
0
xoperatorCommented:
Hey man,

Please notice that in the web world you cant assign any value to input of type password. It wont show you anything in the UI.

0
PaulHewsCommented:
It's a security feature for the textbox.  Otherwise view code would reveal the obfuscated password.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Larry Bristersr. DeveloperAuthor Commented:
om_prakash_p:
Hey man...customer wants the ability to update password with Admin access level...but with seeing the ******************** in the textbox

So..I need the ability to update the password...without anyone seeing it...in case theres someone peeking over their shoulder.
0
Larry Bristersr. DeveloperAuthor Commented:
PaulHews:
So best practice would be to add a checkbox to "update Password" from that field?
0
pschramaCommented:
Shouldn't the customer just use the password textbox to enter the new password then?

Otherwise, there wouldn't be much point in having a webform with a password textbox.

If the password update originates from another source, then there's no need for the password textbox, just update it directly (from source to destination db/table).
0
PaulHewsCommented:
Best practice is to not update the password unless there is text in the textbox.  Leaving it blank should leave it unchanged, and only require it when creating a new record.

Also, typically when using password mode, you would use two textboxes to verify that they match.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Om PrakashCommented:
http://www.codeproject.com/KB/webforms/Set_Password_from_code.aspx
if (this.TextMode == TextBoxMode.Password)
       {
           this.Attributes.Add("value", value);
       }
0
Larry Bristersr. DeveloperAuthor Commented:
om_prakash_p:
Sorry..I posted before you posted this
0
PaulHewsCommented:
>this.Attributes.Add("value", value);

This is working against the security features of the textbox, which is why I don't recommend it.
0
xoperatorCommented:
Please give me some points too !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.