Remove steps in wizard

2 posts, 1 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 29 Jun Link to this post

    What I am trying to do is to remove the steps which are above the clicked step as follows:

     

            Protected Sub RadWizard1_ActiveStepChanged(sender As Object, e As EventArgs)

                Dim a As Integer = TryCast(sender, RadWizard).ActiveStep.Index

                For Each rws As RadWizardStep In RadWizard1.WizardSteps

                    'Response.Write(rws.Index)

                    If rws.Index > a Then
                        rws.Enabled = False 'mark for remove, done because collection is altered
                    End If
                Next

                For Each rwss As RadWizardStep In RadWizard1.WizardSteps
                    If Not rwss.Enabled Then
                        RadWizard1.WizardSteps.Remove(rwss)
                    End If
                Next

            End Sub

    but there is always a step too much left, which is disabled though, but not removed...

     

    Suggestions?

     

    Marc

  2. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 04 Jul Link to this post

    Hello Marc,

    I would suggest you to use a reverse loop, in order to iterate the Steps collection and dynamically remove the disabled steps. Please consider the below implementation:

    For i As Integer = RadWizard1.WizardSteps.Count - 1 To 0 Step -1
             Dim rwss As RadWizardStep = RadWizard1.WizardSteps(i)
             If Not rwss.Enabled Then
                 RadWizard1.WizardSteps.Remove(rwss)
             End If
         Next

    Regards,
    Nencho
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top