Clear Password TextBox in C#.Net
In the Update Mode, I have retrieved the Entered Password开发者_运维技巧 like below:
txtConfirmPassword.Attributes["value"] = DR["Password"].ToString();
But in the Add Mode, I want to clear this TextBox "txtConfirmPassword". I have given like below:
txtConfirmPassword.Text = "";
But it is not clearing. How to clear this TextBox?
You can clear the value in the same way.
txtConfirmPassword.Attributes["value"] = "";
Reason: When you set the TextMode="Password"
, You will not be able to set the .Text
property. In your case you are trying to set txtConfirmPassword.Text = "";
, It will not have an any effect on Textbox.
txtConfirmPassword.Clear();
Isnt that working?
Everything must be so hard with this asp.net try'd to set off/disabled for autocomplete , try'd to change text,try'd to change value attribute ,try'd to format my PC. . . only like this its works :
<asp:TextBox Text="" oninput="this.type='password'" autocomplete="Off" style="border-color:black" CausesValidation="true" runat="server" ID="Password" CssClass="form-control" />
精彩评论