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

Navigate to a specific step

6 Answers 418 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
MBEN
Top achievements
Rank 2
Veteran
MBEN asked on 01 Nov 2017, 04:32 PM

In my wizard code, I want to send the user to a specific step based on a condition.

I can set the ActiveStepIndex to the index of the step but I am unable to figure out how to get the stepindex of a specific step based on the ID of the step.

Please suggest.

6 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 06 Nov 2017, 02:12 PM
Hello MBEN,

The WizardStep has the Active property which could be set to true in order to make the step active. 

<telerik:RadWizard RenderMode="Lightweight" ID="RadWizard1" OnActiveStepChanged="RadWizard1_ActiveStepChanged" runat="server" Height="350px">
    <WizardSteps>
        <telerik:RadWizardStep Title="Approximately Load">
            <telerik:RadRadioButtonList ID="RadRadioButtonList1" runat="server">
                <Items>
                    <telerik:ButtonListItem Text="GoToStep2" Value="2" />
                    <telerik:ButtonListItem Text="GoToStep3" Value="3" />
                    <telerik:ButtonListItem Text="GoToStep4" Value="4" />
                </Items>
            </telerik:RadRadioButtonList>
        </telerik:RadWizardStep>
        <telerik:RadWizardStep ID="RadWizardStep2" Title="Step 2">
            <h1>Step 2</h1>
        </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep3" Title="Step 3">
            <h1>Step 3</h1>
        </telerik:RadWizardStep>
            <telerik:RadWizardStep ID="RadWizardStep4" Title="Step 4">
            <h1>Step 4</h1>
        </telerik:RadWizardStep>
    </WizardSteps>
</telerik:RadWizard>

protected void RadWizard1_ActiveStepChanged(object sender, EventArgs e)
{
    switch (RadRadioButtonList1.SelectedValue)
    {
        case "2": RadWizardStep2.Active = true; break;
        case "3": RadWizardStep3.Active = true; break;
        case "4": RadWizardStep4.Active = true; break;
        default:
            break;
    }
}

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
MBEN
Top achievements
Rank 2
Veteran
answered on 06 Nov 2017, 07:07 PM

What I am actually looking for is how to find the stepindex from the title.

SO in my codebehind i want to know the step index of the wizaed step with the title "Step 3". I use generic code for multiple pages so i don't want to hardcode the stepindex.

0
Peter Milchev
Telerik team
answered on 09 Nov 2017, 03:36 PM
Hello,

Here is a sample implementation that gets the step by a title and then finds its index.

protected void Page_Load(object sender, EventArgs e)
{
    RadWizardStep wizardStep = GetWizardStepByTitle(RadWizard1, "Step 3");
    var wizardStepIndex = -1;
    if (wizardStep != null)
    {
      wizardStepIndex = wizardStep.Index;
    }
}
 
private RadWizardStep GetWizardStepByTitle(RadWizard radWizard, string title)
{
    foreach (RadWizardStep step in radWizard.WizardSteps)
    {
        if (step.Title == title)
        {
            return step;
        }
    }
    return null;
}


Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
SDI
Top achievements
Rank 1
answered on 04 Apr 2018, 06:40 PM

Why in JS is doesnt navigate to that step?

 

var RadWizardProject = $find("<%= RadWizardProject.ClientID%>");

RadWizardProject.get_wizardSteps().getWizardStep(2).set_active(true);

0
SDI
Top achievements
Rank 1
answered on 04 Apr 2018, 07:16 PM
Forget it - it started working now
0
SDI
Top achievements
Rank 1
answered on 04 Apr 2018, 07:17 PM
Forget it - its working now
Tags
Wizard
Asked by
MBEN
Top achievements
Rank 2
Veteran
Answers by
Peter Milchev
Telerik team
MBEN
Top achievements
Rank 2
Veteran
SDI
Top achievements
Rank 1
Share this question
or