By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

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

P: 2
Hello

I am new to ASP.NET. I am using CreateUserWizard control to register & create a user. I am using Membership API. I have a Cancel button on the second step of CreateUserWizard 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 CreateUserWizard control which takes user's login ,Email, Security question, answer's information. My code is as follows:

protected void CreateUserWizard2_CancelButtonClick(object sender, EventArgs e)
{//Calling a function & passing all the createuserwizard controls
DisplayControl(CreateUserWizard2.CreateUserStep.Co ntentTemplateContainer.Controls);
fstname.Focus();
}

private void DisplayControl(ControlCollection 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.WebControls.TextBox )
{
if (((System.Web.UI.WebControls.TextBox)control).ID != "UserName")
((System.Web.UI.WebControls.TextBox)control).Text = "";
}
if (control.Controls != null)
{
DisplayControl(control.Controls);
}
}

}
Apr 7 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.