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

Wizard Cancel Next in code behind

4 Answers 401 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 19 Jan 2015, 08:07 PM
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?

4 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 22 Jan 2015, 12:17 PM
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
0
Daniel
Top achievements
Rank 1
answered on 22 Jan 2015, 07:26 PM
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?

0
Boyan Dimitrov
Telerik team
answered on 27 Jan 2015, 02:09 PM
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
0
Pedro
Top achievements
Rank 1
answered on 24 Mar 2017, 10:41 AM
I don't know if this thread is still alive or not but for future reference: if you use JS to disable the steps in the navigation bar so they can't be clicked, using RenderedSteps=Active causes the JS to not fire and therefore the navigation bar remains clickable
Tags
Wizard
Asked by
Daniel
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Daniel
Top achievements
Rank 1
Pedro
Top achievements
Rank 1
Share this question
or