Solved

Conditional steps in ASP Wizard control

Posted on 2009-04-01
2
985 Views
Last Modified: 2012-05-06
Is it possible to use the Wizard control to skip to different steps depending on the input the user enters?

For example, if there is a yes/no question and the user selects no, then the user would be taken to a page to find out the details of the "no".  Otherwise, it would skip to the next step.

Example:
Step 1: Were tests performed correctly?
If yes, skip to step 2.
If no, go to step 1a to find out what wasn't done correctly, then go to step 2.

Thoughts?
0
Comment
Question by:IntercareSupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 24047341
Hi,

You need to create an eventhandler for the MoveNext command of the Wizard and use the Wizard.MoveTo(WizardStep) method. Consider the attached code an example on how You can do that.

/Carl.
WizardPage.aspx:
 
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="WizardPage.aspx.vb" Inherits="WizardPage" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Wizard ID="Wizard1" runat="server">
            <StartNavigationTemplate>
                <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" 
                    Text="Next"/>
            </StartNavigationTemplate>
            <WizardSteps>
                <asp:WizardStep ID="ws1" runat="server" Title="Step 1">
                    <asp:Label ID="lbl1" runat="server" Text="Were tests performed correctly?" /><br />
                    <asp:RadioButtonList ID="rbl1" runat="server">
                        <asp:ListItem Text="Yes" Value="Yes">
                        </asp:ListItem>
                        <asp:ListItem Text="No" Value="No">
                        </asp:ListItem>
                    </asp:RadioButtonList>
                </asp:WizardStep>
                <asp:WizardStep ID="ws1a" runat="server" Title="Step 1a">
                </asp:WizardStep>
                <asp:WizardStep ID="ws2" runat="server" Title="Step 2">
                </asp:WizardStep>
            </WizardSteps>
        </asp:Wizard>
    </div>
    </form>
</body>
</html>
 
WizardPage.aspx.vb:
 
Partial Class WizardPage
    Inherits System.Web.UI.Page
 
 
    Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick
        If Wizard1.ActiveStepIndex = 0 Then
            If rbl1.SelectedItem.Value = "Yes" Then
                Wizard1.MoveTo(ws2)
            End If
        End If
    End Sub
End Class

Open in new window

0
 

Author Closing Comment

by:IntercareSupport
ID: 31565528
Thanks a lot!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to set focus on a dynamic control 18 52
Import a excel sheet in a grid 2 45
Datagridview column resizing 8 28
SQL query joining 6 tables in asp.net 4 30
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question