ASP. NET Text Box Password Assignment Default Value Method
- 2021-08-31 07:36:22
- OfStack
For ordinary text input boxes, you can use the following methods to assign default values:
<asp:TextBox ID="TextBox1" runat="server">12345</asp:TextBox>
After changing the type of input box to password, the password box on the page is always blank and the default value is lost:
<asp:TextBox ID="TextBox1" runat="server" TextMode="Password">12345</asp:TextBox>
Looking at the html code, it is found that the value attribute is missing, so you can only add another one to the code:
TextBox1.Attributes["value"] = "123456";