Parag’s Den

Dedicated to my adored friends…..

Asp.Net (How to preset the value for a Password field/textbox)

Posted by paragdongre on November 6, 2007


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.

<html>
<head>
<title>Presetting password field – by Das</title>

<script language=vb runat=server>
     Public Sub Page_Load(sender As Object, e As EventArgs)
          txtUserPwd.Attributes(“value”) = “oldpassword”
     End Sub
</script>

</head>

<body>
<form id=”Form1″ runat=”server”>

     <asp:textbox
          id=”txtUserPwd”
          runat=”server”
          textmode=”password” />

</body>
</form>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: