Password textbox - How to fill it?

L

Luiz Vianna

Hi folks,

I have a form.aspx that has an textbox webcontrol named 'password' (and its
texmode=password).

I want to fill it with the password value I have on my database.

The problem is the code

password.text= "mypass"

does not work. It works only when I change it to singleline or multline
textmode.

How do I do that? Fill the password textbox with the value I have keeping
the textmode to password....

Thanks

Luiz
 
V

Victor Garcia Aprea [MVP]

Hi Luiz,

The TextBox class won't write the value attribute if TextMode is set to
Password. This is a good thing as sending the password down the wire in
clear text is really not a good idea. My suggestion is that you explicity
ask the user for the his/her password instead of filling it yourself. That
being said if you *really* want to fill the password for yourself you could
code something like this to force the TextBox to output the input's value,
ie:
[C#]
TextBox1.Attributes.Add("value","YourPassword");

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 
R

rick

Luiz,

Unfortunatly for textbox's with the textmode = password
that won't work. Here's your way to do it:

password.attributes.add("value", "PasswordValue")

-Rick
 

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,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top