ASP Net Controls ASP.Net Tutorial

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



    MultiView & View Controls


    
    

    

MultiView & View Controls


     
                OnSelectedIndexChanged="rblView_SelectedIndexChanged"
         RepeatDirection="Horizontal" runat="server">
         Nothing
         First
         Second
         Third
         Last
       
       
       Current Index: 
     
     
               ActiveViewIndex="0" 
        OnActiveViewChanged="MultiView1_ActiveViewChanged">
                   OnActivate="ActivateView" 
          OnDeactivate="DeactivateView">
           


             First View
           


           
           
           
        
                   OnActivate="ActivateView" 
          OnDeactivate="DeactivateView">
           


             Second View
          


           
           
           
         
                   OnActivate="ActivateView" 
          OnDeactivate="DeactivateView">
           


             Third View


          
           
           
         
                   OnActivate="ActivateView" 
          OnDeactivate="DeactivateView">
           


             Last View
             


           
           
         
       
      
      First TextBox:  
      
      
      Second TextBox:  
      
      
     
      View Activation History:

     
     
      
    
    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page 
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
     lblCurrentIndex.Text = MultiView1.ActiveViewIndex.ToString();
    }
  protected void rblView_SelectedIndexChanged(object sender, EventArgs e)
   {
     MultiView1.ActiveViewIndex = Convert.ToInt32(rblView.SelectedValue);
   }
   
  protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
   {
     lblFirstTextBox.Text = txtFirstView.Text;
     lblSecondTextBox.Text = txtSecondView.Text;
     rblView.SelectedIndex = MultiView1.ActiveViewIndex + 1;
   }
  protected void ActivateView(object sender, EventArgs e)
   {
     string str = lblViewActivation.Text;
     View v = (View)sender;
     str += "View " + v.ID + " activated 
";
     lblViewActivation.Text = str;
   }
   
  protected void DeactivateView(object sender, EventArgs e)
   {
     string str = lblViewActivation.Text;
     View v = (View)sender;
     str += "View " + v.ID + " deactivated 
";
     lblViewActivation.Text = str;
   }
 }