Clear fields on CreateUserWizard, Login control

Posted by Midhat on Stack Overflow See other posts from Stack Overflow or by Midhat
Published on 2009-04-17T10:54:26Z Indexed on 2010/03/31 10:33 UTC
Read the original article Hit count: 540

Filed under:
|
|

I have a createuserwizard and a login control on a page. both of them are customized (standard textboxes are replaced by RadTextBoxes)

When i enter a value in the form and refresh the browser without submitting, the forms retain their values. Is there any way i can clear these fields on refresh.

I have tried settinf EnableViewState false on the controls (as seen somewhere on the web) but it doesnt work

I have added code in page load to clear the fields if the page !IsPostBack. it looks something like this

 if (!IsPostBack)
    {
        ((RadTextBox)Login1.FindControl("Username")).Text="";
        ((RadTextBox)Login1.FindControl("Password")).Text = "";

        ((RadTextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Username")).Text = "";
        ((RadTextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Password")).Text = "";
        ((RadTextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("confirmPassword")).Text = "";
        ((RadTextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email")).Text = "";
    }

Still of no avail Any suggestions

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about CreateUserWizard