Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > multiple forms in asp.net

Reply
Thread Tools

multiple forms in asp.net

 
 
Josh Harris
Guest
Posts: n/a
 
      01-06-2004
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
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      01-06-2004
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.

"Josh Harris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      01-06-2004
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



"Josh Harris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
Josh Harris
Guest
Posts: n/a
 
      01-14-2004
"Steve C. Orr [MVP, MCSD]" <(E-Mail Removed)> wrote in message:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Forms authentication - Multiple login forms based on directory acc Keltex ASP .Net Security 1 01-24-2006 03:06 PM
Multiple forms without multiple windows doug Java 6 01-27-2004 04:20 PM
Multiple forms and Multiple submit buttons and validation sandyde2 Javascript 2 10-02-2003 09:25 AM
Web Forms VS Windows Forms Brendan Miller ASP .Net 2 08-11-2003 09:05 PM



Advertisments