Multi View control in asp.net
For Example: Write a program to demonstrate the use of Multi view Control.
.aspx File
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title> Aryan Computers (MultiView Control) </title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large"
Font-Underline="True" Text="Multiview and View Controls"></asp:Label>
<br />
<br />
<br />
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged2"
AutoPostBack="True">
<asp:ListItem Value="0">Calender Controal</asp:ListItem>
<asp:ListItem Value="1">Password Change Control</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View2" runat="server">
<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Size="X-Large"
ForeColor="Blue" Text="Calender Control"></asp:Label>
<br />
<br />
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
<br />
</asp:View>
<asp:View ID="View1" runat="server" >
<asp:Label ID="Label2" runat="server" Text="Change Your Password" Font-Bold="True"
Font-Size="X-Large" ForeColor="#009900"></asp:Label>
<br />
<br />
<br />
<asp:ChangePassword ID="ChangePassword1" runat="server" style="margin-top: 0px">
</asp:ChangePassword>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
.aspx.cs file
namespace WebApplication33
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged2(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = Convert.ToInt32(DropDownList1.SelectedValue);
}
}
}
Output:
Comments
Post a Comment