Multiview with navigation (VB) : Multiview « Asp Control « ASP.Net

ASP.Net
1. ADO.net Database
2. Ajax
3. Asp Control
4. Collections
5. Components
6. Data Binding
7. Development
8. File Directory
9. HTML Control
10. Language Basics
11. Login Security
12. Mobile Control
13. Network
14. Page
15. Request
16. Response
17. Server
18. Session Cookie
19. Sitemap
20. Theme Style
21. User Control and Master Page
22. Validation by Control
23. Validation by Function
24. WebPart
25. WPF
26. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » Asp Control » Multiview 
Multiview with navigation (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">
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:MultiView ID="mvCheckout" Runat="server" ActiveViewIndex="0" >
            <asp:View ID="vContact" Runat="server">
                Please enter your contact information:<br /><br />
                <table>
                    <tr>
                        <td>First Name:</td>
                        <td>
                            <asp:TextBox ID="txtFirstName" Runat="server" Width="200px" Height="22px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ErrorMessage="First Name is required."
                                ControlToValidate="txtFirstName">
                            </asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>Last name:</td>
                        <td>
                            <asp:TextBox ID="txtLastName" Runat="server" Width="200px" Height="22px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage="Last Name is required."
                                ControlToValidate="txtLastName">
                            </asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>Email:</td>
                        <td>
                            <asp:TextBox ID="txtEmail" Runat="server" Width="200px" Height="22px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" Runat="server" ErrorMessage="Email is required."
                                ControlToValidate="txtEmail">
                            </asp:RequiredFieldValidator>
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Button ID="Button1" runat="server" CommandName="NextView" Text="Next" /></asp:View>
            <asp:View ID="vShippingMethod" Runat="server">
                <asp:Panel ID="Panel1" Runat="server" Width="492">
                    Please select a shipping method:<br />
                    <br />
                    <asp:RadioButton ID="rdoUPSGround" Runat="server" Text="UPS Ground" GroupName="ShipVia"
                        Checked="True" />
                    <br />
                    <asp:RadioButton ID="rdoUPS2Day" Runat="server" Text="UPS Second Day" GroupName="ShipVia" />
                    <br />
                    <asp:RadioButton ID="rdoFedEx" Runat="server" Text="Federal Express Overnight" GroupName="ShipVia" />
                    <br />
                </asp:Panel>
                <br />
                <asp:Button ID="Button2" runat="server" CommandName="PrevView" Text="Previous" />
                <asp:Button ID="Button3" runat="server" CommandName="NextView" Text="Next" /></asp:View>
            <asp:View ID="vCreditCard" Runat="server">
                <asp:Panel ID="Panel2" Runat="server" Width="492px">
                    Please enter your credit card information:<br />
                    <br />
                    <table>
                        <tr>
                            <td><asp:ListBox ID="listCardType" Runat="server">
                                        <asp:ListItem Value="VISA" Selected="True">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>
                                <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>&nbsp;
                            </td>
                        </tr>
                    </table>
                    <br />
                    <asp:Button ID="Button4" runat="server" CommandArgument="PrevView" Text="Previous" />
        <asp:Button ID="btnFinish" Runat="server" Height="24px" Text="Finish" /></asp:Panel></asp:View>
            <asp:View ID="vFinish" runat="server">
                Your order is complete!<br />
                <br />
                Here is the data your entered:<br />
                <br />
        <asp:TextBox ID="txtMessage" runat="server" Height="182px" TextMode="MultiLine" Width="346px"></asp:TextBox><br />
                <br />
                <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="vNavigate" CommandName="SwitchViewByID">Navigation Menu</asp:LinkButton>
            </asp:View>
            <asp:View ID="vNavigate" runat="server">
                <asp:LinkButton CommandArgument="0" CommandName="SwitchViewByIndex" ID="LinkButton1" runat="server">
        View 1: Contact Info</asp:LinkButton><br />
                <asp:LinkButton CommandArgument="vShippingMethod" CommandName="SwitchViewByID" ID="LinkButton2" runat="server">
        View 2: Shipping Method</asp:LinkButton><br />
                <asp:LinkButton ID="LinkButton3" runat="server" CommandArgument="vCreditCard" CommandName="SwitchViewByID">
        View 3: Credit Cart Info</asp:LinkButton></asp:View>
        </asp:MultiView></div>
        <br />
        <asp:Label ID="lblStatus" runat="server"></asp:Label><br />
    </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.EventArgsHandles Me.Load
        If Not IsPostBack Then
            Me.DisplayStatus()
            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 btnFinish_Click(ByVal sender As Object, _
            ByVal e As System.EventArgsHandles btnFinish.Click
        mvCheckout.ActiveViewIndex = 3
        DisplayMessage()
    End Sub

    Protected Sub DisplayMessage()
        Dim shipVia As String
        shipVia = ""
        If (rdoUPSGround.CheckedThen
            shipVia = "UPSG"
        ElseIf (rdoUPS2Day.CheckedThen
            shipVia = "UPS2D"
        ElseIf (rdoFedEx.CheckedThen
            shipVia = "FEDEX"
        End If

        Dim message As String
        message = _
         "Contact info" & ControlChars.Cr & _
         "    First name: " & txtFirstName.Text & ControlChars.Cr & _
         "    Last name: " & txtLastName.Text & ControlChars.Cr & _
         "    Email: " & txtEmail.Text & ControlChars.Cr & _
         "Shipping method" & ControlChars.Cr & _
         "    Ship via: " & shipVia & ControlChars.Cr & _
         "Credit card info" & ControlChars.Cr & _
         "    Type: " & listCardType.SelectedValue & ControlChars.Cr & _
         "    Number: " & txtCardNumber.Text & ControlChars.Cr & _
         "    Expiration date: " & ddlExpirationMonth.SelectedValue & "/" & _
                                   ddlExpirationYear.SelectedValue
        txtMessage.Text = message
    End Sub

    Protected Sub mvCheckout_ActiveViewChanged(ByVal sender As Object, _
            ByVal e As System.EventArgsHandles mvCheckout.ActiveViewChanged
        Me.DisplayStatus()
    End Sub

    Private Sub DisplayStatus()
        Dim viewNumber As Integer = mvCheckout.ActiveViewIndex + 1
        lblStatus.Text = "View " & viewNumber & " of " & mvCheckout.Views.Count
    End Sub
End Class

 
Related examples in the same category
1. asp:multiview Demo (C#)
2. MultiView Demo
3. asp:MultiView set up
4. Multiview with style
5. Multiview checkout (C#)
6. Multiview checkout (VB)
7. Multiview with navigation (C#)
8. MultiView ActiveViewIndex Example
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.