1. Open Visual Studio
2. Create a New Website
3. Create Web Page
4. Place MultiView on a page and two View inside Multiview Control
5. Set ActiveViewIndex Property of MultiView to 0
2. Create a New Website
3. Create Web Page
4. Place MultiView on a page and two View inside Multiview Control
5. Set ActiveViewIndex Property of MultiView to 0
6. Add Code to Click Event of Next Button
protected void Button2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
7. Add Code to Click Event of the Previous Button
protected void Button4_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
8. Full code
MultiviewDemo.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
.style3
{
width: 265px;
}
.style4
{
width: 271px;
}
.style5
{
width: 105px;
}
.style6
{
width: 125px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<table class="style1">
<tr>
<td class="style5">
Login Form</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
Username</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
Password</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
<asp:Button ID="Button1" runat="server" Text="Login" />
</td>
<td>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Next" />
</td>
</tr>
</table>
</asp:View>
<br />
<asp:View ID="View2" runat="server">
<table class="style1">
<tr>
<td class="style6">
Registration form</td>
<td>
</td>
</tr>
<tr>
<td class="style6">
Name</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style6">
Email</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style6">
Address</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style6">
Phone</td>
<td>
<asp:TextBox ID="TextBox6" runat="server" Width="216px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style6">
<asp:Button ID="Button3" runat="server" Text="Submit" />
</td>
<td>
<asp:Button ID="Button4" runat="server" onclick="Button4_Click"
Text="Previous" />
</td>
</tr>
<tr>
<td class="style6">
</td>
<td>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>
MultiviewDemo.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MultiviewDemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
protected void Button4_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
}
No comments:
Post a Comment
Thanks