Basic Wizard : Wizard « Asp Control « ASP.Net






Basic Wizard


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="BasicWizard" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:Wizard ID="Wizard1" 
                   runat="server" 
                   Width="467px" 
                   BackColor="#EFF3FB" 
                   BorderColor="#B5C7DE" 
                   BorderWidth="1px" 
                   Font-Names="Verdana"
                   CellPadding="5" 
                   ActiveStepIndex="0" 
                   Font-Size="Small" 
                   OnFinishButtonClick="Wizard1_FinishButtonClick">
              <WizardSteps>
                <asp:WizardStep ID="WizardStep1" runat="server" Title="Personal">
                  <h3>Personal Profile</h3>
                  Preferred Programming Language:
                  <asp:DropDownList ID="lstLanguage" runat="server">
                    <asp:ListItem>C#</asp:ListItem>
                    <asp:ListItem>VB .NET</asp:ListItem>
                    <asp:ListItem>J#</asp:ListItem>
                    <asp:ListItem>Java</asp:ListItem>
                    <asp:ListItem>C++</asp:ListItem>
                    <asp:ListItem>C</asp:ListItem>         
                  </asp:DropDownList>
                  <br />
                </asp:WizardStep>
                <asp:WizardStep ID="WizardStep2" 
                                runat="server" 
                                Title="Company">
                  <h3>Comany Profile</h3>
                  Number of Employees: <asp:TextBox ID="txtEmpCount" runat="server"></asp:TextBox><br />
                  Number of Locations: &nbsp;<asp:TextBox ID="txtLocCount" runat="server"></asp:TextBox>
                </asp:WizardStep>
                <asp:WizardStep ID="WizardStep3" 
                                runat="server" 
                                Title="Software">
                  <h3>Software Profile</h3>
                  Licenses Required:
                  <asp:CheckBoxList ID="lstTools" runat="server">
                    <asp:ListItem>Visual Studio</asp:ListItem>
                    <asp:ListItem>Office</asp:ListItem>
                    <asp:ListItem>Windows 2003 Server</asp:ListItem>
                    <asp:ListItem>SQL Server 2005</asp:ListItem>
                    <asp:ListItem>BizTalk 2004</asp:ListItem>
                  </asp:CheckBoxList>
                </asp:WizardStep>
                <asp:WizardStep ID="Complete" runat="server" Title="Complete " StepType="Complete">
                Summary: <asp:Label ID="lblSummary" runat="server" Text="Label"></asp:Label>


                </asp:WizardStep>
              </WizardSteps>
           <SideBarStyle VerticalAlign="Top" />
             
            </asp:Wizard>
    </div>
    </form>
</body>
</html>

File: Default.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class BasicWizard : System.Web.UI.Page
{
  protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
  {
    StringBuilder sb = new StringBuilder();
    sb.Append("<b>You chose: <br />");
    sb.Append("Programming Language: ");
    sb.Append(lstLanguage.Text);
    sb.Append("<br />Total Employees: ");
    sb.Append(txtEmpCount.Text);
    sb.Append("<br />Total Locations: ");
    sb.Append(txtLocCount.Text);
    sb.Append("<br />Licenses Required: ");
    foreach (ListItem item in lstTools.Items)
    {
      if (item.Selected)
      {
        sb.Append(item.Text);
        sb.Append(" ");
      }
    }
    sb.Append("</b>");
    lblSummary.Text = sb.ToString();
  }
}

 








Related examples in the same category

1.how to set up and use a wizard.
2.Wizard template
3.Checkout wizard
4.Checkout wizard (VB)
5.Wizard ActiveStepIndex
6.Wizard history
7.Use WizardStep
8.Wizard Demo
9.Wizard finish button click event