I have a dropdownlist on my web page along with a textbox which has property set to password field.

Now dropdownlist has autopostback property true.

When i change anything in dropdownlist, Password field gets erased.

So how can i prevent password field from getting empty at time of page post back

Easiest answer, disable autopostback on the dropdown.

the password form is getting posted back to the server every time there is a postback, you'll need to grab it at the same time you take care of the dropdown box, otherwise you need to change when your postbacks are occurring.

I got Answer

protected override void OnPreRender(EventArgs e)
        txtPassword.Attributes.Add("value", txtPassword.Text);

Hello Makarand,

I think that will expose your password on the client side. Must be session variables would be a good thought.