简体   繁体   中英

Initialize TextBox with the Password TextMode

I'm trying to initialize the TextBox with the Password TextMode in my C# code. I do it in Page_Load function. But after the output in a browser there is no text.

this.passwordTextBox.Text = this.GetData().Password;
this.confirmPasswordTextBox.Text = this.GetData().Password;

How can I assing a value to this property?

You can set the password using:

this.passwordTextBox.Attributes["value"] = this.GetData().Password;

or

this.passwordTextBox.Attributes.Add("value", this.GetData().Password);

Setting the Value of a TextBox with TextMode=Password

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM