Navigate to a specific step

7 posts, 0 answers
  1. MBEN
    MBEN avatar
    197 posts
    Member since:
    Nov 2011

    Posted 01 Nov 2017 Link to this post

    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.

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    395 posts

    Posted 06 Nov 2017 Link to this post

    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.
  3. MBEN
    MBEN avatar
    197 posts
    Member since:
    Nov 2011

    Posted 06 Nov 2017 in reply to Peter Milchev Link to this post

    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.

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    395 posts

    Posted 09 Nov 2017 Link to this post

    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.
  5. SDI
    SDI avatar
    104 posts
    Member since:
    Nov 2011

    Posted 04 Apr in reply to Peter Milchev Link to this post

    Why in JS is doesnt navigate to that step?

     

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

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

  6. SDI
    SDI avatar
    104 posts
    Member since:
    Nov 2011

    Posted 04 Apr in reply to SDI Link to this post

    Forget it - it started working now
  7. SDI
    SDI avatar
    104 posts
    Member since:
    Nov 2011

    Posted 04 Apr in reply to SDI Link to this post

    Forget it - its working now
Back to Top