Mega Code Archive

 
Categories / ASP.Net / Asp Control
 

Checkout wizard

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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>         <strong>Halloween Superstore - Checkout</strong><br />         <br />         <asp:Wizard ID="wizCheckout" runat="server"  Width="739px"              DisplayCancelButton="True"             OnCancelButtonClick="wizCheckout_CancelButtonClick" >             <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>                             <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>                         </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.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; public partial class Checkout : System.Web.UI.Page {     protected void Page_Load(object sender, EventArgs e)     {         if (!IsPostBack)         {             wizCheckout.ActiveStepIndex = 0;             int year = DateTime.Now.Year;             for (; year < DateTime.Now.Year + 6; year++)                 ddlExpirationYear.Items.Add(year.ToString());         }     }     protected void wizCheckout_CancelButtonClick(object sender, EventArgs e)     {         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;     } }