Wizard Control Challenge

  • Thread starter Thread starter Nightcrawler
  • Start date Start date
N

Nightcrawler

I am using a Wizard control with 5 steps. On step 2 the user is
present with a radiobuttonlist with two listitems in it. If the first
radiobutton is selected I want to take the user to step 3, if the
second is selected I want to take the user to step 4. I have the
OnActiveStepEvent that fires on every step and the code looks like
this:

if (Wizard.ActiveStepIndex == 2)
{
switch (RadioButtonList.SelectedValue)
{
case "2":
Wizard.ActiveStepIndex = 2;
break;
case "3":
Wizard.ActiveStepIndex = 3;
break;
}
}

I also have the following code

if (Wizard.ActiveStepIndex == 3)
{
Preforming some logic here
Wizard.ActiveStepIndex = 4;
}

Here is the problem. If case = 2 the first if statement takes the user
is taken to ActiveStepIndex = 2 (Step 3) just like it is supposed to.
When the user then clicks 'next' the second if statement becomes true,
some logic is preformed and the user gets taken to ActiveStep = 4
(step 5).

However, if case = 3 the first if statement takes the user to
ActiveStepIndex = 3 (step 4) BUT that steps get skipped since the
second if statement now becomes true and the user gets taken to
ActiveStep = 4 (step 5) right away instead. In addition I get an error
since the the logic performed in the second if statement is only
supposed to be executed if case = 2.

Is there a way to solve this problem in some nice, clean way?

Thanks
 
Hi,

Try this:


[OnActiveStepEvent EventHandler]
{
switch (Wizard.ActiveStepIndex)
{
case 0://Step 1
/*
<Logic for Step 1 goes here...>
*/
break;
case 1://Step 2
/*
<Logic for Step 2 goes here...>
*/
break;
case 2://Step 3
switch (RadioButtonList.SelectedValue)
{
case "2":
/*
<Logic for Step 3 goes here...>
*/
break;
case "3":
Wizard.ActiveStepIndex = 3;
break;
}
break;
case 3://Step 4
/*
<Logic for Step 4 goes here...>
*/
Wizard.ActiveStepIndex = 4;
break;
case 4://Step 5
/*
<Logic for Step 5 goes here...>
*/
break;
}
}

Hope this helps!
Thanks -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top