0

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

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by questpond
0

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.

0

I got Answer

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

Hello Makarand,

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

Edited by Ezzaral: Snipped "fake sig" link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.