Wizard Cancel Next in code behind

4 posts, 0 answers
  1. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2014

    Posted 19 Jan 2015 Link to this post

    How can a user be prevented from going to the next step in code behind? I need to verify some information and if the information is invalid prevent the user from going to the next step. The information can only be verified in code behind. I don't see a "e.Cancel" as in the asp.net wizard.What do I do?
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 22 Jan 2015 Link to this post

    Hello,

    One possible way to implement custom validation on the server is: 

         1. To use the RadWizard server-side event ( for example OnNextButtonClick) and perform the validation in the event handler.
         2. If the validation fails to change the RadWizard1.ActiveStepIndex to the current step index.
     
    Alternative way would be to use the validation functionality of the RadWizard control. Please find the RadWizard Validation help article and RadWizard validation demo.


    Regards,
    Boyan Dimitrov
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2014

    Posted 22 Jan 2015 Link to this post

    I tried your suggestion but the next step is first displayed then it goes back to the current step. That is obviously not acceptable. I need to cancel moving to the next step BEFORE it happens.  The basic ASP.NET wizard System.Web.UI.WebControls.WizardNavigationEventArgs  has a Cancel property when set to True it does not allow moving to the next step. How do I accomplish that using the Telerik wizard?

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 27 Jan 2015 Link to this post

    Hello,

    By default all wizard steps are rendered on the client-side, but only the active one is shown. In this case navigation between the steps occurs on the client-side first (displayed) and then the server-side events are fired. Your observations are correct that the next step is displayed and the event is fired after that.

    In order to avoid this behavior I would suggest setting the RadWizard RenderedSteps="Active". The server event will be fired and then the next step will be shown ( if the validation not fails). In this only the active step is rendered on the client and the next/previous step is requested from the server.


    Regards,
    Boyan Dimitrov
    Telerik
Back to Top