Set Text Property of a Textbox of Type Password in ASP.Net using code is not straight forward as it is like a TextBox of TextMode Single or Mode Multiline.
So the question arises that can we set the Text or value to a TextBox of Type Password or Mode=Password?
Well the answer is YES.
Lets see how can we do that
Suppose you have a TextBox Control name TextBox1 and its TextMode is set to Password. Now to set the Text to this control we have to set text through its Attributes Property like this
Using c# Code
this
.TextBox1.Attributes["value"] = "YourPassword";
Using Vb.Net Code
Me
.TextBox1.Attributes("value") = "YourPassword"
Hope this will help all who are trying to set the text to a TextBox control with its TextMode property to Password.
Happy Coding!!!
Praveen