multiple forms on single page?

K

Ken Dopierala Jr.

Hi,

In ASP multiple forms were no problem at all. In ASP.Net you can only have
one form (Form1) for server controls. These will then be available to you
with their values when you post back. You can also add all the other forms
you want but they won't be as useable server-side. I believe you can still
get your values but you need to go through the Request object rather than
having an object that represents each control to work with. I may be wrong
about that last point though so hopefully someone who knows for sure can
talk about this. Good luck! Ken.
 
G

Guest

You can only have 1 <form id="myForm" runat="server"> server control.
However, you can still use plain ole html forms with action="some url"; but
it cannot have a runat="server". Once you do this, you cannot have any
asp.net server controls within this HTML form tag.

There is a work-a-round comming is asp.net 2.0. Stay tuned!
 
I

Ian Suttle

If you are simply referring to a matter of having the tags in the same
page, but not needing to use them all at the same time, you can put
them in panels. When the HTML is rendered, only 1 FORM tag should be
visible (all panels with form tags but one should be hidden).

Perhaps if you explain your intent we can provide a solution.
Thanks,
Ian Suttle
http://www.IanSuttle.com
 
S

Steve C. Orr [MVP, MCSD]

You can only have one visible server form on the page at a time.
So you could have more than one server form as long as you only show one at
a time.
Or you can have more than one form visible on your page at a time, but only
one of them can be a server form (i.e. with the runat=server attribute.)
Server forms only support posting back to themselves (not to other pages.)

This will all become more flexible in .NET version 2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top