Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to use Wizard Control in ASP.NET

Author: Mike Green

Wizard Control lets you to get step by step information from user with facility for the user to skip steps or to go back to previous step.

 

In classic ASP, we don’t have this kind of control so we consume lot of time to get step by step user information. Wizard Control in ASP.NET provides multi-step user interface to get data. It is very nice control when we need lots of information from user. We can create steps for related information and can give facility to user to skip steps. Wizard Control simplifies the multi-step process for developers and users. Furthermore you can configure Wizard Control according to your need. So when you have large forms and you need lots of information from user, it is better to use Wizard control in your page. This will ease the process of getting and providing information.

 

Wizard Control Templates
 
Template
Description
HeaderTemplate
It indicates the Title Bar of the Wizard
SideBarTemplate
It is used to display steps of the Wizard Control on left side.
StartNavigationTemplate
This template is for the first view of the Wizard Control. It contains “Next” button by default.
StepNavigationTemplate
This template is for steps other than Start and finish. It contains “Previous” and “Next” buttons by default.
FinishNavigationTemplate
It is for the finish of Wizard Control. It contains “Previous” and “Finish” buttons by default.

 

Wizard Control Events

Template
Description
ActiveStepChanged
User switches to a new page in the control
NextButtonClick
This event is for Next button click
PreviousButtonClick
This event is for Previous button click
SideBarButtonClick
This event is for button click in the side bar area
FinishButtonClick
This event is for Finish button click

 

  1. Open MS Visual Studio 2010
  2. File > New > Website > Visual C# or Visual Basic > ASP.NET Empty Web Site
  3. Select Web Location as File System and Click OK
  4. From Menu, Website > Add New Item > Select Web Form and Click Add
  5. Drag and drop a Wizard Control and configure it from smart arrow at the top or write code below in aspx page

    <asp:Wizard ID="Wizard1" runat="server" BackColor="#E6E2D8"
                BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
                Font-Names="Verdana" Font-Size="0.8em">
                <HeaderStyle BackColor="#666666" BorderColor="#E6E2D8" BorderStyle="Solid"
                    BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="White"
                    HorizontalAlign="Center" />
                <HeaderTemplate>
                    Simple Wizard Example
                </HeaderTemplate>
                <NavigationButtonStyle BackColor="White" BorderColor="#C5BBAF"
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em"
                    ForeColor="#1C5E55" />
                <SideBarButtonStyle ForeColor="White" />
                <SideBarStyle BackColor="#1C5E55" Font-Size="0.9em" VerticalAlign="Top" />
                <StepStyle BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderStyle="Solid"
                    BorderWidth="2px" />
                <WizardSteps>
                    <asp:WizardStep ID="WizardStep1" runat="server" Title="Name">
       
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="Label1" runat="server" Text="First Name:"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label2" runat="server" Text="Last Name:"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </asp:WizardStep>
                    <asp:WizardStep ID="WizardStep2" runat="server" Title="Contact">
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="Label3" runat="server" Text="Email:"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label4" runat="server" Text="Phone:"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </asp:WizardStep>
                    <asp:WizardStep ID="WizardStep3" runat="server" Title="Address">
                    <table>
                            <tr>
                                <td>
                                    <asp:Label ID="Label5" runat="server" Text="City"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label6" runat="server" Text="Country:"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                                </td>
                            </tr>
       
                        </table>
                    </asp:WizardStep>
           </WizardSteps>
      </asp:Wizard>


    For this example, three steps are added to Wizard Control but you can add as many as you like and get the information from user.
     
  6.  Now browse the website see the Wizard control in action. 

 

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< DropDownList SelectedIndexChanged method in ASP.NET

Disclaimer - Privacy
© 2002-2017 DevASP.net