Playing around today, and I know strange tricks with ASP.NET 1.1. If you try to add two forms to ASP.NET pages, you get a nice error:

A page can have one server-side Form tag.

Apparently, the message must be added to read:

A page can have only one visible server-side Form tag.

This form has a Visible property. Where we can switch back and forth. The default value is true, and only the HTML for the visible form is provided to clients. If the Visible property. The shape is wrong, still can coexist on the page, not only given to clients. This could be interesting to implement something similar to the control wizard in ASP.NET 2.0.

<% @ Page Language = "c #"%>
<DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.0 Transitional / / EN">
<HTML>
<HEAD>
<title> WebForm1 </ title>
<script runat=server language="C#">
private void Page_Load (object sender, System.EventArgs e)
{
Form1.Visible = Form1.Visible;!
Form2.Visible = Form2.Visible;!
}
</ Script>
</ HEAD>

<body MS_POSITIONING="GridLayout">
<form method="POST" id="Form1" runat="server">
runat = "server"> <asp: TextBox id = "textbox2" Form1 </ asp: TextBox>
<asp:Button Runat=server ID="Button1" NAME="Button1" Text="Click to see Form2"/>
</ Form>
<form method="POST" id="Form2" runat="server" visible="false">
runat = "server"> <asp: TextBox id = "textbox1" Form2 </ asp: TextBox>
<asp:Button Runat=server ID="Button2" NAME="Button2" Text="Click to see Form1"/>
</ Form>
</ Body>
</ HTML>
Categories: