Textbox Bug?

G

Guest

Weird Bug..
I am trying to execute this code, essentially a few fields to update a
custom user login / info form values from DB
This code works;
txtUsername.Text = userReader.Item("username")
txtPassword.Text = userReader.Item("Password")
However, it displays the password of the user. I want to mask it with the
password char format. So I add the line of code / or (set the textbox mode
in properties)
txtPassword.TextMode = TextBoxMode.Password.
The text disappears, blank box , no *** chars , nothing visible or
selectable in the box. However, adding debug code says there is something in
the box, and it has a len().....??? Invisible, non-selectable text?
I tried this on several machines with the same results..
Whats up Microsoft?? Thanks..
KT
 
T

Teemu Keiski

Basically the Text is there in Text property, but in TextBox with Password
mode, it won't render the Value attribute. it will with all other modes.
That's how it works. Security stuff, I believe.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


<kt> wrote in message Weird Bug..
I am trying to execute this code, essentially a few fields to update a
custom user login / info form values from DB
This code works;
txtUsername.Text = userReader.Item("username")
txtPassword.Text = userReader.Item("Password")
However, it displays the password of the user. I want to mask it with the
password char format. So I add the line of code / or (set the textbox mode
in properties)
txtPassword.TextMode = TextBoxMode.Password.
The text disappears, blank box , no *** chars , nothing visible or
selectable in the box. However, adding debug code says there is something in
the box, and it has a len().....??? Invisible, non-selectable text?
I tried this on several machines with the same results..
Whats up Microsoft?? Thanks..
KT
 
Joined
Sep 25, 2008
Messages
1
Reaction score
0
Work around for assigning Text to TextBox while its in Password Mode

Weird Bug..
I am trying to execute this code, essentially a few fields to update a
custom user login / info form values from DB
This code works;
txtUsername.Text = userReader.Item("username")
txtPassword.Text = userReader.Item("Password")
However, it displays the password of the user. I want to mask it with the
password char format. So I add the line of code / or (set the textbox mode
in properties)
txtPassword.TextMode = TextBoxMode.Password.
The text disappears, blank box , no *** chars , nothing visible or
selectable in the box. However, adding debug code says there is something in
the box, and it has a len().....??? Invisible, non-selectable text?
I tried this on several machines with the same results..
Whats up Microsoft?? Thanks..
KT

Hi,
You can do the following to programmatically assign values to TextBox while it is in Password Mode.

TextBoxPassword.Attributes.Add("value", "blablabla");

Where TextBoxPassword is the name of that textbox which is in Password Mode. and "blablabla" is the text you are going to assign to it.

To download the fully functional control and more detail you can visit following link at code project.
http://www.codeproject.com/KB/webforms/Set_Password_from_code.aspx

Comments and suggestions are welcomed.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top