Setting Value in Textbox with TextMode=”Password”

Recently,

I had a requirement, that when user details are edited the admin should be able to edit the password.

First I should to display clear password (ofcourse it is worng) as that page was visible to admin only.

Then I had to change that and had to display asterik (‘*’) instead of clear password.

So Obvisiouly I did something like

18 this.txtPassword.Text = (string)dr[0];

But this did not work for me

So I googled and found this article

Setting Value of Password Field

so I just changed the above code to

18 this.txtPassword.Attributes.Add(“value”,(string)dr[0]);

and it worked liked a charm.

Note: Please do read this article, if you want to preserve the value for password field even when postback occurs.

That’s all folks.
Hope you enjoyed this post.

Comments Good as well as Bad are most welcome.

NJoy !!! 🙂

Advertisements

One Response to Setting Value in Textbox with TextMode=”Password”

  1. Mahesh says:

    its working …thank u …

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: