Friday, April 29, 2011

Clear fields on CreateUserWizard, Login control

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

From stackoverflow
  • Turned out to be the Behavior of RadTextBox in Mozilla firefox

0 comments:

Post a Comment