I'm using a 2.0 Wizard control which I want my users to be able to jump into from another page using hyperlinks to determine which step to start at.
I've tried setting the ActiveStepIndex in Page.OnLoad but I'm getting some quite unexpected behaviour from the Wizard control in terms of the events that subsequently fire, and I find that the Wizard won't let me move any further back from the step I initially
set the ActiveStepIndex to.
Has anyone experienced this too, and do they have a workaround? It seems a little quirky, but it might be me misunderstanding how to use the ActiveStepIndex property properly.
The following simple example illustrates what I'm talking about. Try putting trace messages on the WizardStep.Activate/Deactivate events and you'll see some funky stuff going on. Note that if you use the sidebar to go back beyond the 'jumped-to' step, the wizard
seems to be freed up again...
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnInit(EventArgs e)
{
// only check on first time in
if (!IsPostBack)
// look in querystring for jump command
if (Request.QueryString["jumptostep"] != null)
// do the jump
TheWizard.ActiveStepIndex = Convert.ToInt32(Request.QueryString["jumptostep"]);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title /></head>
<body>
<form id="form1" runat="server">
imagine these links are on another page:<br />
jump in at: [<a href="?jumptostep=1">step 1</a>][<a href="?jumptostep=2">step 2</a>]
<hr />
<asp:Wizard ID="TheWizard" runat="server">
<WizardSteps>
<asp:WizardStep ID="Step0" runat="server">Step 0</asp:WizardStep>
<asp:WizardStep ID="Step1" runat="server">Step 1</asp:WizardStep>
<asp:WizardStep ID="Step2" runat="server">Step 2</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</form>
</body>
</html>
Can anyone shed any light as to what's going on? This has been driving me barmy all of Friday and it's going to spoil my weekend at this rate!
Matt Wynne
Member
40 Points
8 Posts
Setting ActiveStepindex on a Wizard Control
Mar 18, 2006 04:34 PM|LINK
I've tried setting the ActiveStepIndex in Page.OnLoad but I'm getting some quite unexpected behaviour from the Wizard control in terms of the events that subsequently fire, and I find that the Wizard won't let me move any further back from the step I initially set the ActiveStepIndex to.
Has anyone experienced this too, and do they have a workaround? It seems a little quirky, but it might be me misunderstanding how to use the ActiveStepIndex property properly.
The following simple example illustrates what I'm talking about. Try putting trace messages on the WizardStep.Activate/Deactivate events and you'll see some funky stuff going on. Note that if you use the sidebar to go back beyond the 'jumped-to' step, the wizard seems to be freed up again...
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnInit(EventArgs e)
{
// only check on first time in
if (!IsPostBack)
// look in querystring for jump command
if (Request.QueryString["jumptostep"] != null)
// do the jump
TheWizard.ActiveStepIndex = Convert.ToInt32(Request.QueryString["jumptostep"]);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title /></head>
<body>
<form id="form1" runat="server">
imagine these links are on another page:<br />
jump in at: [<a href="?jumptostep=1">step 1</a>][<a href="?jumptostep=2">step 2</a>]
<hr />
<asp:Wizard ID="TheWizard" runat="server">
<WizardSteps>
<asp:WizardStep ID="Step0" runat="server">Step 0</asp:WizardStep>
<asp:WizardStep ID="Step1" runat="server">Step 1</asp:WizardStep>
<asp:WizardStep ID="Step2" runat="server">Step 2</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</form>
</body>
</html>
Can anyone shed any light as to what's going on? This has been driving me barmy all of Friday and it's going to spoil my weekend at this rate!
cheers,
Matt