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

How to change Active Wizard from Client Side Script

1 Answer 280 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Yahya
Top achievements
Rank 1
Yahya asked on 11 Aug 2016, 09:26 AM

Hi Guys,

I spend lots of time but unable to success to skip the wizard step based on condition. I used differernt techniques but didn't get success kindly guide me. I just want to skip some steps based on certain condition.

Using: 

            function changeActiveIndex(gotoIndex) {
                var wizard = $find("<%= RadWizard1.ClientID %>");
                wizard.set_activeIndex(gotoIndex);
                //wizard.set_activeWizardStep = wizard.get_wizardStepByIndex(2);
            }

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 12 Aug 2016, 06:03 AM
Hello Yahya,

Here's an example how you can skip a step conditionally. In this case the condition is whether the user has clicked the Next button (in that case args.get_command() will return "1" in the OnClientButtonClicked event handler):
<script type="text/javascript">
    function OnClientButtonClicked(sender, args) {
        var command = args.get_command();
        if (command == "1") {
            var activeIndex = sender.get_activeIndex();
            if (activeIndex > 0) {
                sender.set_activeIndex(activeIndex + 1)
            }
        }
    }
</script>
<div>
    <telerik:RadWizard ID="RadWizard1" runat="server" OnClientButtonClicked="OnClientButtonClicked">
        <WizardSteps>
            <telerik:RadWizardStep ID="RadWizardStep1" runat="server" Title="Step 1">
            </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep2" Title="Step 2" runat="server" StepType="Step">
            </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep3" Title="Step 3" runat="server" StepType="Step">
            </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep4" Title="Step 4" runat="server" StepType="Step">
            </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep5" runat="server" Title="Step 5" StepType="Finish">
            </telerik:RadWizardStep>
        </WizardSteps>
    </telerik:RadWizard>
</div>


Regards,
Ivan Danchev
Telerik by Progress
Tags
Wizard
Asked by
Yahya
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or