Checkout wizard (VB) : Wizard « Asp Control « ASP.Net






Checkout wizard (VB)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Checkout" %>

<!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 id="Head1" runat="server">
    <title>Chapter 20 Checkout Wizard</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Wizard ID="wizCheckout" runat="server" ActiveStepIndex="0" 
            Width="739px" >
            <WizardSteps>
                <asp:WizardStep ID="WizardStep1" runat="server"
                    Title="Step 1: Contact Info">
                    Please enter your contact information:<br /><br />
                    <table>
                      <tr>
                        <td>First Name:</td>
                        <td>
                            <asp:TextBox ID="txtFirstName" runat="server"
                                Height="22px" Width="200px"></asp:TextBox>
                            <asp:RequiredFieldValidator
                                ID="RequiredFieldValidator1" 
                                runat="server" 
                                ControlToValidate="txtFirstName"
                                ErrorMessage="First Name is required."></asp:RequiredFieldValidator>
                        </td>
                      </tr>
                      <tr>
                        <td>Last name:</td>
                        <td>
                            <asp:TextBox ID="txtLastName" runat="server"
                                Height="22px" Width="200px"></asp:TextBox>
                            <asp:RequiredFieldValidator
                                ID="RequiredFieldValidator2" 
                                runat="server" 
                                ControlToValidate="txtLastName"
                                ErrorMessage="Last Name is required."></asp:RequiredFieldValidator>
                        </td>
                      </tr>
                      <tr>
                        <td>Email:</td>
                        <td>
                            <asp:TextBox ID="txtEmail" runat="server"
                                Height="22px" Width="200px"></asp:TextBox>
                            <asp:RequiredFieldValidator
                                ID="RequiredFieldValidator3" 
                                runat="server" 
                                ControlToValidate="txtEmail"
                                ErrorMessage="Email is required."></asp:RequiredFieldValidator>
                        </td>
                      </tr>
                    </table>
                </asp:WizardStep>
                <asp:WizardStep ID="WizardStep2" runat="server"
                     Title="Step 2: Shipping Method">
                    Please select a shipping method:<br /><br />
                    <asp:RadioButton ID="rdoUPSGround" runat="server"
                        Checked="True" GroupName="ShipVia" Text="UPS Ground" />
                    <br />
                    <asp:RadioButton ID="rdoUPS2Day" runat="server"
                        GroupName="ShipVia" Text="UPS Second Day" />
                    <br />
                    <asp:RadioButton ID="rdoFedEx" runat="server"
                        GroupName="ShipVia" Text="Federal Express Overnight" />
                    <br />
                </asp:WizardStep>
                <asp:WizardStep ID="WizardStep3" runat="server"
                    Title="Step 3: Credit Card Info">
                    Please enter your credit card information:<br />
                    <br />
                    <table>
                      <tr>
                        <td>
                            <div style="text-align: right">
                                <asp:ListBox ID="lstCardType"
                                    runat="server">
                                    <asp:ListItem Selected="True"
                                        Value="VISA">Visa</asp:ListItem>
                                    <asp:ListItem Value="MC">
                                        MasterCard</asp:ListItem>
                                    <asp:ListItem Value="AMEX">
                                        American Express</asp:ListItem>
                                </asp:ListBox>
                            </div>
                        </td>
                        <td>Card Number:</td>
                        <td>
                            <asp:TextBox ID="txtCardNumber" runat="server"
                                Height="22px" Width="262px"></asp:TextBox>
                        </td>
                      </tr>
                      <tr>
                        <td>Expiration Date:
                        </td>
                        <td valign="middle">
                            <asp:DropDownList ID="ddlExpirationMonth"
                                runat="server">
                                <asp:ListItem Value="1">January</asp:ListItem>
                                <asp:ListItem Value="2">February</asp:ListItem>
                                <asp:ListItem Value="3">March</asp:ListItem>
                                <asp:ListItem Value="4">April</asp:ListItem>
                                <asp:ListItem Value="5">May</asp:ListItem>
                                <asp:ListItem Value="6">June</asp:ListItem>
                                <asp:ListItem Value="7">July</asp:ListItem>
                                <asp:ListItem Value="8">August</asp:ListItem>
                                <asp:ListItem Value="9">September</asp:ListItem>
                                <asp:ListItem Value="10">October</asp:ListItem>
                                <asp:ListItem Value="11">November</asp:ListItem>
                                <asp:ListItem Value="12">December</asp:ListItem>
                            </asp:DropDownList>&nbsp;
                            <asp:DropDownList ID="ddlExpirationYear"
                                runat="server">
                            </asp:DropDownList>
                        </td>
                      </tr>
                    </table>
                </asp:WizardStep>
            </WizardSteps>
        </asp:Wizard>
    </div>
    </form>
</body>
</html>

File: Default.aspx.vb


Partial Class Checkout
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            wizCheckout.ActiveStepIndex = 0
            Dim iYear As Integer
            For iYear = DateTime.Now.Year To DateTime.Now.Year + 5
                ddlExpirationYear.Items.Add(iYear.ToString())
            Next
        End If
    End Sub

    Protected Sub wizCheckout_CancelButtonClick(ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles wizCheckout.CancelButtonClick
        wizCheckout.ActiveStepIndex = 0
        txtFirstName.Text = ""
        txtLastName.Text = ""
        txtEmail.Text = ""
        rdoUPSGround.Checked = True
        rdoUPS2Day.Checked = False
        rdoFedEx.Checked = False
        lstCardType.SelectedIndex = 0
        txtCardNumber.Text = ""
        ddlExpirationMonth.SelectedIndex = 0
        ddlExpirationYear.SelectedIndex = 0
    End Sub

End Class

 








Related examples in the same category

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