<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Multiple Server Forms--Kind of Wizard</title>
</head>
<body>
<div id="pageContent">
<form id="step0" runat="server" visible="true">
<h1>Welcome</h1>
<asp:textbox runat="server" id="Textbox1" />
<asp:button ID="Button1" runat="server" text="Step #1" OnClick="Button1_Click" />
</form>
<form id="step1" runat="server" visible="false">
<h1>Step #1</h1>
<asp:textbox runat="server" id="Textbox2" />
<asp:button ID="Button2" runat="server" text="Previous step" OnClick="Button2_Click" />
<asp:button ID="Button3" runat="server" text="Step #2" OnClick="Button3_Click" />
</form>
<form id="step2" runat="server" visible="false">
<h1>Finalizing</h1>
<asp:button ID="Button4" runat="server" text="Finish" OnClick="Button4_Click" />
</form>
</div>
</body>
</html>
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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_Load(object sender, EventArgs e)
{
Title = "Welcome";
}
protected void Button1_Click(object sender, EventArgs e)
{
Title = "Step 1";
step0.Visible = false;
step1.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
step0.Visible = true;
step1.Visible = false;
}
protected void Button3_Click(object sender, EventArgs e)
{
Title = "Finalizing";
step1.Visible = false;
step2.Visible = true;
}
protected void Button4_Click(object sender, EventArgs e)
{
Title = "Done";
step2.Visible = false;
Response.Write("<h1>Successfully done.</h1>");
}
}