multiple forms in asp.net

  • Thread starter Thread starter Josh Harris
  • Start date Start date
J

Josh Harris

I am using the IBuySpy portal in c#. The problem I am having is in
nesting a second form within the page. The entire page is within one
form (for the user controls). I want to have a form that allows users
to search a phone list by entering a name, and clicking "submit".
This is extremely easy to do with a simple html form. This is not the
case with asp.net though, I cannot have an html form nested within the
main form for the page. This means that I have to create a user
control that has the form contained within it, make a post back to the
server and then redirect the user to the search result page. This is
a huge setback in my opinion, am I missing something? is there a
better way to handle this?

TIA
-Josh
 
First of all, you can never nest one HTML form inside another in any HTML
document. Secondly, a WebForm Page can have one and only one runat=server
form on it. It can have any number of regular HTML forms in it that live
outside of the WebForm.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
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.)

It's my understanding that this will become more flexible in .NET version 2.
 
Steve C. Orr said:
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.)

It's my understanding that this will become more flexible in .NET version 2.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


I solved the problem by creating a hidden form outside of the server
form, and then creating a javascript function that is called when the
submit button is clicked that will call the post method of the hidden
form.

Thanks for the replies.
 
Back
Top