How to add custom functionality to Next Button in a Wizard

3 posts, 0 answers
  1. Usman
    Usman avatar
    2 posts
    Member since:
    May 2013

    Posted 12 May 2013 Link to this post

    Hello,...
    i want to validate my wizard panels fields on the next button click....
  2. Paul
    Admin
    Paul avatar
    60 posts

    Posted 14 May 2013 Link to this post

    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?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Usman
    Usman avatar
    2 posts
    Member since:
    May 2013

    Posted 17 May 2013 Link to this post

    Thanks Paul...
    I have tried it and it worked fine.
Back to Top