Plz Help : Want to clear Email,Question, Answer TextBoxes in CreateUserWizard control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asumal
    New Member
    • Apr 2008
    • 2

    Plz Help : Want to clear Email,Question, Answer TextBoxes in CreateUserWizard control

    Hello

    I am new to ASP.NET. I am using CreateUserWizar d control to register & create a user. I am using Membership API. I have a Cancel button on the second step of CreateUserWizar d control alongwith Create User button & Previous button. Actually, i have added some more textboxes on the default control for taking user's personal information. The problem is that when i call the below mentioned code all textboxes for user's personal information gets cleared but not the default controls on the CreateUserWizar d control which takes user's login ,Email, Security question, answer's information. My code is as follows:

    protected void CreateUserWizar d2_CancelButton Click(object sender, EventArgs e)
    {//Calling a function & passing all the createuserwizar d controls
    DisplayControl( CreateUserWizar d2.CreateUserSt ep.Co ntentTemplateCo ntainer.Control s);
    fstname.Focus() ;
    }

    private void DisplayControl( ControlCollecti on Controls)
    { //recusive routine that can go through the entire control hierarchy
    //making empty all textbox controls except with id=username
    foreach (System.Web.UI. Control control in Controls)
    {
    if (control is System.Web.UI.W ebControls.Text Box )
    {
    if (((System.Web.U I.WebControls.T extBox)control) .ID != "UserName")
    ((System.Web.UI .WebControls.Te xtBox)control). Text = "";
    }
    if (control.Contro ls != null)
    {
    DisplayControl( control.Control s);
    }
    }

    }
Working...