This is a migrated thread and some comments may be shown as answers.

How to add custom functionality to Next Button in a Wizard

2 Answers 464 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Usman
Top achievements
Rank 1
Usman asked on 12 May 2013, 05:18 PM
Hello,...
i want to validate my wizard panels fields on the next button click....

2 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 14 May 2013, 01:00 PM
Hello Usman,

Thank you for writing.

In order to implement validation for your input fields you may use the "Next" event or perhaps the SelectedPageChanging event in certain cases. I believe that the Next event should be sufficient in most of the cases though. When you subscribe to the event you can check on which page are you at the moment and make the necessary validations. If the validations do not pass you can cancel the event and show the appropriate message to the user.
private void Form1_Load(object sender, EventArgs e)
{
    this.radWizard1.Next += radWizard1_Next;
}
         
void radWizard1_Next(object sender, Telerik.WinControls.UI.WizardCancelEventArgs e)
{
    if (this.radWizard1.SelectedPage == this.radWizard1.Pages[1]) // Check if this is the desired page
    {
        // Do some validation here
        // If the validation does not pass
        
        e.Cancel = true;
                     
        // Show some message to the user
    }
}

I am attaching a small project which will show you everything in action.

Hope this helps.

All the best,
Paul
the Telerik team
RadChart for WinForms is obsolete. Now what?
0
Usman
Top achievements
Rank 1
answered on 17 May 2013, 10:03 AM
Thanks Paul...
I have tried it and it worked fine.
Tags
Wizard
Asked by
Usman
Top achievements
Rank 1
Answers by
Paul
Telerik team
Usman
Top achievements
Rank 1
Share this question
or