asp:MultiView set up : Multiview « Asp Control « ASP.Net

Home
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
ASP.Net » Asp Control » Multiview 
asp:MultiView set up

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
    <asp:MultiView ID="MultiView1" 
                   runat="server" 
                   ActiveViewIndex="0" 
                   OnActiveViewChanged="MultiView1_ActiveViewChanged">
     <asp:View ID="View1" runat="server">
      <b>Showing View #1</b><br />
       <asp:Button ID="cmdNext" runat="server" Text="Next >" CommandName="NextView" />
     </asp:View>
     <asp:View ID="View2" runat="server">
      <b>Showing View #2</b><br />
        Text content.
           <asp:Button ID="cmdPrev" runat="server" Text="< Prev" CommandName="PrevView" />
           <asp:Button ID="cmdNext2" runat="server" Text="Next >" CommandName="NextView" />
     </asp:View>
         <asp:View ID="View3" runat="server">
         <b>Showing View #3</b><br />
         <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
         <asp:Button ID="Button1" runat="server" Text="< Prev" CommandName="PrevView" />
     </asp:View>
    </asp:MultiView>
    </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 MultipleViews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
      DropDownList1.DataSource = MultiView1.Views;
      DropDownList1.DataTextField = "ID";
      DropDownList1.DataBind();
    }
    }
  
  protected void cmdShow_Click(object sender, EventArgs e)
  {
    MultiView1.ActiveViewIndex = DropDownList1.SelectedIndex;
  }
  protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
  {
    DropDownList1.SelectedIndex = MultiView1.ActiveViewIndex;
  }
}

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