Asp Control ASP.Net

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



    Chapter 20: Checkout MultiView


    
    

        
            
                
                  
                    
                    
                  
                  
                    
                    
                  
                  
                    
                    
                  
                
First Name:
                                                    Width="200px" Height="22px">
                                                    ID="RequiredFieldValidator1" Runat="server" 
                            ErrorMessage="First Name is required."
                            ControlToValidate="txtFirstName">
                        
                    
Last name:
                                                             Runat="server"
                                     Width="200px" 
                                     Height="22px">
                                                    ID="RequiredFieldValidator2" Runat="server" 
                            ErrorMessage="Last Name is required."
                            ControlToValidate="txtLastName">
                        
                    
Email:
                                                    Runat="server"
                            Width="200px" 
                            Height="22px">
                                                    ID="RequiredFieldValidator3" 
                            Runat="server" 
                            ErrorMessage="Email is required."
                            ControlToValidate="txtEmail">
                        
                    

                
                                    CommandName="NextView" Text="Next" />
            
            
                                           Runat="server" 
                           Width="492">
                    Please select a shipping method:
                                            Runat="server" 
                        Text="UPS Ground" 
                        GroupName="ShipVia"
                        Checked="True" />
                    
                                                         Runat="server" 
                                     Text="UPS Second Day" 
                                     GroupName="ShipVia" />
                    
                                                         Runat="server" 
                                     Text="Federal Express Overnight" 
                                     GroupName="ShipVia" />
                    
                
                                    CommandName="PrevView" Text="Previous" />
                                    CommandName="NextView" Text="Next" />
            
            
                
                    Please enter your credit card information:
                    
                    
                      
                        
                        
                        
                      
                      
                        
                        
                      
                    
                                    Runat="server">
                                                                            Selected="True">Visa
                                    
                                        MasterCard
                                    
                                        American Express
                                
                        
Card Number:
                                                            Height="22px" Width="262px">
                        
Expiration Date:
                                                            Runat="server">
                                January
                                February
                                March
                                April
                                May
                                June
                                July
                                August
                                September
                                October
                                November
                                December
                             
                                                            Runat="server">
                        

                    
                                            CommandName="PrevView" Text="Previous" />
                                            CommandName="NextView" Text="Finish"
                        OnClick="btnFinish_Click" />
                
            
            
                Here is the data you entered:
                                    Height="182px" TextMode="MultiLine" Width="346px">
                
            
        

    


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)
        {
            int year = DateTime.Now.Year;
            for (; year < DateTime.Now.Year + 6; year++)
                ddlExpirationYear.Items.Add(year.ToString());
        }
    }
    protected void btnFinish_Click(object sender, EventArgs e)
    {
        this.DisplayMessage();
    }
    private void DisplayMessage()
    {
        string shipVia = "";
        if (rdoUPSGround.Checked)
            shipVia = "UPSG";
        else if (rdoUPS2Day.Checked)
            shipVia = "UPS2D";
        else if (rdoFedEx.Checked)
            shipVia = "FEDEX";
        string message =
            "Contact info\n" +
            "    First name: " + txtFirstName.Text + "\n" +
            "    Last name: " + txtLastName.Text + "\n" +
            "    Email: " + txtEmail.Text + "\n" +
            "Shipping method\n" +
            "    Ship via: " + shipVia + "\n" +
            "Credit card info\n" +
            "    Type: " + listCardType.SelectedValue + "\n" +
            "    Number: " + txtCardNumber.Text + "\n" +
            "    Expiration date: " + ddlExpirationMonth.SelectedValue + "/"
                                    + ddlExpirationYear.SelectedValue;
        txtMessage.Text = message;
    }
}