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

Remove steps in wizard

1 Answer 233 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 29 Jun 2016, 01:31 PM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 04 Jul 2016, 08:21 AM
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
Tags
Wizard
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Nencho
Telerik team
Share this question
or