Multiview control example

Multiview control example

Previous Home Next

 

The ASP.NET MultiView control can be used for virtually anything. Introduced in ASP.NET 2.0, the MultiView provides exactly that - multiple views on one page, with one view being displayed at a time. This provides a great advantage over Panels when trying to develop a multi-step process, as you are not required to set the visibility of each individual view for each step. Instead, you can just set the currently active view. All controls within each view will be accessible in the code-behind.

 
  

 
Views:-
 A reference to a ViewCollection instance that contains all the View controls defined for this MultiView. You can create View controls dynamically and add them to this collection or remove them in code.
 
ActiveViewIndex:-
 A read/write Integer value that indicates which view will be displayed, as the zero-based index of that view in the ViewCollection.
 
NextViewCommandName:-
 A Static String field containing the name of the command that moves to the next view. The default value is NextView.
 
PreviousViewCommandName:-
 A Static String field containing the name of the command that moves to the previous view. The default value is PrevView.
 
SwitchViewByIDCommandName:-
 A Static String field containing the name of the command that moves to the view whose ID is given in the CommandArgument property. The default value is SwitchViewByID.
 
SwitchViewByIndexCommandName:-
 A Static String field containing the name of the command that moves to the view whose index is given in the CommandArgument property. The default value is SwitchViewByIndex.
 
Method:=
 
GetActiveView():-
 Returns a reference to the currently displayed view as a View control instance.
 
SetActiveView(view):-
 Takes a reference to a View control instance and sets the ActiveViewIndex so that this View instance is displayed.
 
Event:-
 ActiveViewChanged:-
 Raised when the active view is changed.
 

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





    Untitled Page


  
This is View1. Click the button to goto View 2. This is View2. Enter your name and click the button to goto View 3.
Name:
This is View3.


...................................................................
Previous Home Next