You are here:   Articles
Register   |  Login

Programming Articles

Minimize
11

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.

  1. Use an IFRAME and include your FORM in the IFRAME.
  2. Use the Asp:Button PostBackUrl property.

    <asp:Button
      ID="Button1"
      PostBackUrl=http://www.domain.com/handleform.aspx"
      Runat="server"
      Text="Send" />
  3. 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

Posted in: Asp.net

Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

Programmer Newsletter

Minimize

Subscribe to the Internet Handholding newsletter



Reccomend Programmer.bz

Minimize

Share/Bookmark Bookmark and Share