How to preset the value for a Password field/textbox in ASP.NET?

Question

How to preset the value for a Password field/textbox in ASP.NET?

Re: How to preset the value for a Password field/textbox in ASP.

For a textbox, whose textmode property is defined as "password", we cannot assign a predefined value while declaring the control. But there are plenty of occasions in which we need to preset the value of password field. Well we can do this. The following example explains this.

Presetting password field - by Das

Public Sub Page_Load(sender As Object, e As EventArgs)
txtUserPwd.Attributes("value") = "oldpassword"
End Sub


id="txtUserPwd"
runat="server"
textmode="password" />