Wizard template : Wizard « Asp Control « ASP.Net






Wizard template


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

<!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>
                  Number of Locations: <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" />
           
             <HeaderTemplate>
    <i>Header Template</i> -
    <b><%= Wizard1.ActiveStep.Title %></b>
  </HeaderTemplate>
           <StepNavigationTemplate>
           <i>StepNavigationTemplate</i><br />
               <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                   Text="Previous" />
               <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" />
           </StepNavigationTemplate>
           <StartNavigationTemplate>
           <i>StartNavigationTemplate</i><br />
               <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Next" />
           </StartNavigationTemplate>
           <FinishNavigationTemplate>
           <i>FinishNavigationTemplate</i><br />
               <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                   Text="Previous" />
               <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
           </FinishNavigationTemplate>
            </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 WizardTemplates : System.Web.UI.Page
{
  protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
  {
    StringBuilder sb = new StringBuilder();
    sb.Append("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(" ");
      }
    }
    lblSummary.Text = sb.ToString();
  }
}

 








Related examples in the same category

1.Basic Wizard
2.how to set up and use a wizard.
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