MultiView Example in ASP.NET using C#

MultiView Example in ASP.NET using C#


Posted in : ASP.Net Posted on : November 26, 2010 at 6:07 PM Comments : [ 0 ]

In this article we will introduce with MultiView control in ASP.NET using C#.

MultiView Example in ASP.NET using C#

MultiView control in ASP.NET acts as a container for group of view controls. You can see the all view in a single MultiView control in a single web page. You will use the more than one View in a MultiView control. Your one or more operation will be performed in a single page. In this example we make three View in a MultiView control. When user selects the view from DropDownList it will be shown in MultiView control.

MultiView.aspx (Design Page):

MultiView.aspx (source code):

<%@ Page Title="" Language="C#" MasterPageFile="~/RoseindiaMaster.master" 
AutoEventWireup="true" CodeFile="Multiview.aspx.cs" Inherits="Multiview" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="width: 360px">
<h2 style="color:Green">Multiview in ASP.NET 4 , C#</h2>
Select View :&nbsp;&nbsp;&nbsp;
<asp:DropDownList ID="drp" runat="server" AutoPostBack="True" 
onselectedindexchanged="drp_SelectedIndexChanged" Width="120px">
<asp:ListItem Value="0">View 1</asp:ListItem>
<asp:ListItem Value="1">View 2</asp:ListItem>
<asp:ListItem Value="2">View 3</asp:ListItem>
</asp:DropDownList>
<br />
<hr />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
---Now showing First View (Registration)---
<br />
<br />
User name:
<br />
<asp:TextBox ID="TextBox1" runat="server" />
<br />
Email-id:
<br />
<asp:TextBox ID="TextBox2" runat="server" />
<br />
Password:
<br />
<asp:TextBox ID="TextBox3" runat="server" TextMode="Password"/>
<br />
Confirm Password:
<br />
<asp:TextBox ID="TextBox4" runat="server" TextMode="Password"/>
<br />
<asp:Button ID="registerButton" runat="server" Text="Register" />
</asp:View>
<asp:View ID="View2" runat="server">
---Now showing Second View (Login)---
<br />
<br />
User name:
<br />
<asp:TextBox ID="TextBox5" runat="server" />
<br />
Password:
<br />
<asp:TextBox ID="TextBox6" runat="server" TextMode="Password"/>
<br />
<asp:Button ID="loginButton" runat="server" Text="Login" Width="70px" />
</asp:View>
<asp:View ID="View3" runat="server">
---Now showing Second View (Forget Password)---
<br />
<br />
User name:
<br />
<asp:TextBox ID="TextBox7" runat="server" />
<br />
Email-id:
<br />
<asp:TextBox ID="TextBox8" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" Width="70px" />
</asp:View>
</asp:MultiView>
</div>
</asp:Content>

Output:

When you select the View 1 from DropDownList the form will be shown like this:

When you select the View 2 from DropDownList the form will be shown like this:

When you select the View 3 from DropDownList the form will be shown like this:

Download source code
Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics