Software Programming posted on January 11, 2010 16:01
Asp.net does not allow you to have multiple html FORM tags on the same page, sort of.
The reason for this is Asp.net uses the FORM tag with the runat="server" attribute to process the form.
You could create a second form outside the FORM tags with the runat="server" attribute, but Asp.net will not process the second form.
The problem is, this may not be what you want. If you have an email sign up form or a buy now button, you may want the multiple forms inside the Asp.net FORM tags.
There are a few techniques you can use to accomplish this.
- Use an IFRAME and include your FORM in the IFRAME.
- Use the Asp:Button PostBackUrl property.
<asp:Button
ID="Button1"
PostBackUrl=http://www.domain.com/handleform.aspx"
Runat="server"
Text="Send" />
- Use client side redirection.
<input type="button" value="Send"
onClick="location.href='http://www.domain.com/handleform.aspx">
By Andrew Weitzen, Bronze Inc. (c) 2010
Bronze is the publisher of several online Internet journals including: InternetHandholding.com, DomainNames.gs, DotNetNuke.bz, Programmer.bz, Software.vg, WebHosting.vg