How can I keep show "password" instead of stars in password textmoded textbox?
I want to show stars instead of password when I select password from database.
txtPassw开发者_如何转开发ord.text = usr.M_Password;
But after page load, password text box being empty however its textmode is password. And also when I write something in it, the stars shown. Do you have any idea about this?
KR,
Çağın
An <asp:TextBox />
with a textmode
of password is Read Only.
You can't dynamically set the value.
You'll need to have two textboxes. One where the textmode is normal, and one where the textmode is password.
When the focus is set on the normal textbox, you'll need to hide it, and then show the textbox with textmode as password. You can't set the value of the password textbox from the database, again, as it is read only.
Add a Value Attribute to the Textbox using a randomly generated String with the exact amount of letters as the original Password instead, since this will appear in the markup, but it's the only way to actually set the shown text of a Password-TextBox. Your user will be under the illusion of his password being entered whilst you take the actual Password-Value from somewhere else (DB, Backend, etc.).
The password will be displayed in stars and it works across PostBacks, you can't simply set the Text-Property without working with JS.
You must be resetting the value of the txtPassword.Text
property somewhere, or the value you're pulling back from the database is actually empty. Post more code for a better response.
精彩评论