You are here:   Home
Register   |  Login

Programmer Newsletter

Minimize

Master Programmer

Minimize

Find articles on computer software, programming, ASP.net, Sql server, databases, C#, websites, Internet, Windows, Outlook macros.

Programming Articles

Minimize
12

Asp.net only allows one form with the attribute server="runat" per web page.

However, on the client side, you can have as many forms as you want.

So, the trick is to write a close form tag (</form>) to close the asp.net form, before you create your forms on your web page and then write an open form tag (<form>) to match the asp.net closing form tag.

In between you can create all the forms you like and submit them wherever you like.

<form runat="server"><!-- asp.net form -->
</form><!-- close asp.net form -->

<form><!-- Your form -->
</form>

<form><!-- Your form -->
</form>

<form><!-- to match closing tag -->
</form><!-- asp.net closing form tag -->

Just write your form tags in a way that asp.net does not know about them. For example, to close the asp.net <form> tag, you can do this.

<%="</form>"%>

Should you do this?

The answer is sometimes, depending on what you need. This is another tool in your programming arsenal.

Another tool is to put multiple asp.net forms in an iframe.

For example, on my main Asp.net page, in the right column, I have three email signup forms. The signup forms are in an iframe. The source page for the iframe is another asp.net page that uses the closing form trick here to include the three forms on one page within the iframe.

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

MAKE YOUR PC SUPER FAST Discover 5 Shockingly Simple Techniques That Will Make Any Old Computer Run At Top Speed.

Drive Traffic to Your Website with Article Underground. Increase Your Visitors and Your Profits.

HOW TO HYPNOTIZE ANYONE AT WILL! Amazing Secrets to Hypnotize Anyone, Anywhere, at Any Time for Whatever Reason.



Programming Bookmark

Minimize

Share/Bookmark Bookmark and Share