Kirk Evans is a Microsoft Architect for the Azure Center of Excellence.
Introduction to SharePoint and Azure IaaS
Building SharePoint Apps with Windows Azure Platform as a Service
SharePoint Solutions and Architectures on Windows Azure Infrastructure Services
Understanding Authentication and Permissions with Apps for SharePoint and Office
Tinkering around today, and I figured out a weird trick with ASP.NET 1.1. If you try to add 2 forms to an ASP.NET page, you get a nice error:
A page can have only one server-side Form tag.
Apparently, that message should be augmented to read:
A page can have only one visible server-side Form tag.
The form has a .Visible property, which we can toggle back and forth. The default value is true, and only the HTML for the visible form is rendered to the client. If a form's .Visible property is false, it can still coexist on the page, it just is not rendered to the client. This could be interesting for implementing something similar to the wizard control in ASP.NET 2.0.
<%@ Page language="c#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<script runat=server language="C#">
private void Page_Load(object sender, System.EventArgs e)
Form1.Visible = !Form1.Visible;
Form2.Visible = !Form2.Visible;
<form id="Form1" method="post" runat="server" >
<asp:TextBox id="Textbox2" runat="server">Form1</asp:TextBox>
<asp:Button Runat=server ID="Button1" NAME="Button1" Text="Click to see Form2"/>
<form id="Form2" method="post" runat="server" visible="false">
<asp:TextBox id="TextBox1" runat="server">Form2</asp:TextBox>
<asp:Button Runat=server ID="Button2" NAME="Button2" Text="Click to see Form1"/>
Putting two logical forms into just one real form dramatically increases difficuty of HTML5 validation, for example.
thank you so very much!!!!!! it worked!!!!!
no its working properly!! form 2 becomes invisible!!! I want to see form 1 as well as form 2 on my page!!
Just give up. Its not possible. WebForms needs the form on the whole page to handle post backs. The only way to avoid this is to not use postbacks, but at that point, you may as well not use WebForms.
Want a search form that redirects to a search page using get parameters? Postback and redirect.
Want a contact form that posts to an external api? No can do. Postback and proxy.
want a payment form that posts variables to ebanking gateway? Don't even bother. Postback and proxy.
Or, don't use Webforms. It's 2014.