473,569 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested Forms in ASP.NET

Hi,
As you all know when an ASP.NET web form is created that will include
web controls and such, it contains a
FORM that that identifies the web form and its containing controls.

Well, I have a web form who has several other (user & custom) controls,
these are enclosed within the standard
FORM tag. Additionally *some* of these user controls are actually forms as
well. This results into nested Forms.

I was noticing that this seems to cause certain confusion on the browser
sometimes. I checked the HTML and it is ok.

It has the following forms:
1. ASP.NET Web Form tag (Form1)
2. Login form (Login)
3. Google search form (Google)
4. PayPal form (PayPal)

2 through 4 are obviously embedded into the #1 form. On FireFox I notice
that one of the forms is not reported by the PageInfo dialog (very handy
tool). I reported it as a bug there but I wonder if this actually causes
problems with ASP.NET. Why? because when the order of my forms were 1, 4, 2,
3 and I had a user control that had a form as well (that would have been
just the ASP.NET web controls without FORM tag because it is always
contained in #1) then the "Submit" button would no longer work.

Strange... Now in the order shows above (1.2.3.4) the submit button works
(you can click and it posts back). Any ideas?

Thx
Emilio
Nov 19 '05 #1
5 5325
User controls should generally not contain Form tags, or else it causes
problems like you're describing.
Other details:
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.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
As you all know when an ASP.NET web form is created that will include
web controls and such, it contains a
FORM that that identifies the web form and its containing controls.

Well, I have a web form who has several other (user & custom) controls,
these are enclosed within the standard
FORM tag. Additionally *some* of these user controls are actually forms as
well. This results into nested Forms.

I was noticing that this seems to cause certain confusion on the browser
sometimes. I checked the HTML and it is ok.

It has the following forms:
1. ASP.NET Web Form tag (Form1)
2. Login form (Login)
3. Google search form (Google)
4. PayPal form (PayPal)

2 through 4 are obviously embedded into the #1 form. On FireFox I notice
that one of the forms is not reported by the PageInfo dialog (very handy
tool). I reported it as a bug there but I wonder if this actually causes
problems with ASP.NET. Why? because when the order of my forms were 1, 4,
2, 3 and I had a user control that had a form as well (that would have
been just the ASP.NET web controls without FORM tag because it is always
contained in #1) then the "Submit" button would no longer work.

Strange... Now in the order shows above (1.2.3.4) the submit button works
(you can click and it posts back). Any ideas?

Thx
Emilio

Nov 19 '05 #2
Yes, actually I forgot to mention that only Form #1 was a server form
(runat), all the others are "regular" forms but are nested within the server
form. Would that cause problems as well?

The issue is that the "master" page contains the server form, within the
form there is an HTML table that splits the web form into 3 columns (left &
right navigation panel and mid content panel). There can be "applets" on the
left and right sides, these are simple regular forms (normal HTML forms),
but the whole thing is within the server form, only they don't have a runat
attribute.

Regards,
Emilio

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
User controls should generally not contain Form tags, or else it causes
problems like you're describing.
Other details:
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.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
As you all know when an ASP.NET web form is created that will include
web controls and such, it contains a
FORM that that identifies the web form and its containing controls.

Well, I have a web form who has several other (user & custom) controls,
these are enclosed within the standard
FORM tag. Additionally *some* of these user controls are actually forms
as well. This results into nested Forms.

I was noticing that this seems to cause certain confusion on the browser
sometimes. I checked the HTML and it is ok.

It has the following forms:
1. ASP.NET Web Form tag (Form1)
2. Login form (Login)
3. Google search form (Google)
4. PayPal form (PayPal)

2 through 4 are obviously embedded into the #1 form. On FireFox I notice
that one of the forms is not reported by the PageInfo dialog (very handy
tool). I reported it as a bug there but I wonder if this actually causes
problems with ASP.NET. Why? because when the order of my forms were 1, 4,
2, 3 and I had a user control that had a form as well (that would have
been just the ASP.NET web controls without FORM tag because it is always
contained in #1) then the "Submit" button would no longer work.

Strange... Now in the order shows above (1.2.3.4) the submit button works
(you can click and it posts back). Any ideas?

Thx
Emilio


Nov 19 '05 #3
I don't believe the HTML specification supports nested forms.
Multiple forms are ok, but not inside eachother.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:OE******** ******@TK2MSFTN GP15.phx.gbl...
Yes, actually I forgot to mention that only Form #1 was a server form
(runat), all the others are "regular" forms but are nested within the
server form. Would that cause problems as well?

The issue is that the "master" page contains the server form, within the
form there is an HTML table that splits the web form into 3 columns (left
& right navigation panel and mid content panel). There can be "applets" on
the left and right sides, these are simple regular forms (normal HTML
forms), but the whole thing is within the server form, only they don't
have a runat attribute.

Regards,
Emilio

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
User controls should generally not contain Form tags, or else it causes
problems like you're describing.
Other details:
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.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
As you all know when an ASP.NET web form is created that will include
web controls and such, it contains a
FORM that that identifies the web form and its containing controls.

Well, I have a web form who has several other (user & custom) controls,
these are enclosed within the standard
FORM tag. Additionally *some* of these user controls are actually forms
as well. This results into nested Forms.

I was noticing that this seems to cause certain confusion on the browser
sometimes. I checked the HTML and it is ok.

It has the following forms:
1. ASP.NET Web Form tag (Form1)
2. Login form (Login)
3. Google search form (Google)
4. PayPal form (PayPal)

2 through 4 are obviously embedded into the #1 form. On FireFox I notice
that one of the forms is not reported by the PageInfo dialog (very handy
tool). I reported it as a bug there but I wonder if this actually causes
problems with ASP.NET. Why? because when the order of my forms were 1,
4, 2, 3 and I had a user control that had a form as well (that would
have been just the ASP.NET web controls without FORM tag because it is
always contained in #1) then the "Submit" button would no longer work.

Strange... Now in the order shows above (1.2.3.4) the submit button
works (you can click and it posts back). Any ideas?

Thx
Emilio



Nov 19 '05 #4
Then what would be the best way to handle it? it all has to do with how the
page functions:

+-------------------------------------------------------------------------------------+
| [HEADER]
|
+------------------+---------------------------------------------+--------------------+
| LEFT PANE | MIDDLE PANE
| RIGHT PANE |
| [Literal] |
| |
| [Form A] | Content
| [Literal] |
| | [Possibly some web controls]
| [Form B] |
| |
| [Form C] |
+------------------+---------------------------------------------+-------------------+
| F O O T E R
|
+--------------------------------------------------------------------------------------+

Form A: Login HTML form (not an ASP.NET form)
Form B: Google search form (not an ASP.NET form)
Form C: PayPal button form (not an ASP.NET form) <- UserControl

And then, HEADER is an ASP.NET composite control, and the two Literals, as
well as some
that *may* appear in the middle pane are the simple ASP.NET WebControls
(TextBox, Literal,
Button, radioButton, etc.). Because of that those need to be enclosed in the
ASP.NET server
form (form id="Form1").

I don't think ASP.NET is not able to handle this sort of layout which is not
complex at all and
since I cannot have multiple server forms I cannot regroup the literals and
the other web controls
to beginning or end without totally destroying the page layout.

As you can see, this is some sort of page template. Anyway suggestions are
appreciated.

Regards,
Emilio
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:ei******** ******@tk2msftn gp13.phx.gbl...
I don't believe the HTML specification supports nested forms.
Multiple forms are ok, but not inside eachother.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:OE******** ******@TK2MSFTN GP15.phx.gbl...
Yes, actually I forgot to mention that only Form #1 was a server form
(runat), all the others are "regular" forms but are nested within the
server form. Would that cause problems as well?

The issue is that the "master" page contains the server form, within the
form there is an HTML table that splits the web form into 3 columns (left
& right navigation panel and mid content panel). There can be "applets"
on the left and right sides, these are simple regular forms (normal HTML
forms), but the whole thing is within the server form, only they don't
have a runat attribute.

Regards,
Emilio

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
User controls should generally not contain Form tags, or else it causes
problems like you're describing.
Other details:
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.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
As you all know when an ASP.NET web form is created that will
include web controls and such, it contains a
FORM that that identifies the web form and its containing controls.

Well, I have a web form who has several other (user & custom) controls,
these are enclosed within the standard
FORM tag. Additionally *some* of these user controls are actually forms
as well. This results into nested Forms.

I was noticing that this seems to cause certain confusion on the
browser sometimes. I checked the HTML and it is ok.

It has the following forms:
1. ASP.NET Web Form tag (Form1)
2. Login form (Login)
3. Google search form (Google)
4. PayPal form (PayPal)

2 through 4 are obviously embedded into the #1 form. On FireFox I
notice that one of the forms is not reported by the PageInfo dialog
(very handy tool). I reported it as a bug there but I wonder if this
actually causes problems with ASP.NET. Why? because when the order of
my forms were 1, 4, 2, 3 and I had a user control that had a form as
well (that would have been just the ASP.NET web controls without FORM
tag because it is always contained in #1) then the "Submit" button
would no longer work.

Strange... Now in the order shows above (1.2.3.4) the submit button
works (you can click and it posts back). Any ideas?

Thx
Emilio



Nov 19 '05 #5
Try making the middle pane a form run at the server, and put everything else
(including other forms) outside that form. You can still run other items
outside the form at the server, so you could dynamically change the header.

HTH, ME

--
Martin Eyles
ma**********@NO SPAM.bytronic.c om

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:e6******** ******@TK2MSFTN GP11.phx.gbl...
Then what would be the best way to handle it? it all has to do with how the page functions:

+---------------------------------------------------------------------------
----------+ | [HEADER]
|
+------------------+---------------------------------------------+----------
----------+ | LEFT PANE | MIDDLE PANE
| RIGHT PANE |
| [Literal] |
| |
| [Form A] | Content
| [Literal] |
| | [Possibly some web controls]
| [Form B] |
| |
| [Form C] |
+------------------+---------------------------------------------+----------
---------+ | F O O T E R
|
+---------------------------------------------------------------------------
-----------+
Form A: Login HTML form (not an ASP.NET form)
Form B: Google search form (not an ASP.NET form)
Form C: PayPal button form (not an ASP.NET form) <- UserControl

And then, HEADER is an ASP.NET composite control, and the two Literals, as
well as some
that *may* appear in the middle pane are the simple ASP.NET WebControls
(TextBox, Literal,
Button, radioButton, etc.). Because of that those need to be enclosed in the ASP.NET server
form (form id="Form1").

I don't think ASP.NET is not able to handle this sort of layout which is not complex at all and
since I cannot have multiple server forms I cannot regroup the literals and the other web controls
to beginning or end without totally destroying the page layout.

As you can see, this is some sort of page template. Anyway suggestions are
appreciated.

Regards,
Emilio
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:ei******** ******@tk2msftn gp13.phx.gbl...
I don't believe the HTML specification supports nested forms.
Multiple forms are ok, but not inside eachother.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:OE******** ******@TK2MSFTN GP15.phx.gbl...
Yes, actually I forgot to mention that only Form #1 was a server form
(runat), all the others are "regular" forms but are nested within the
server form. Would that cause problems as well?

The issue is that the "master" page contains the server form, within the form there is an HTML table that splits the web form into 3 columns (left & right navigation panel and mid content panel). There can be "applets"
on the left and right sides, these are simple regular forms (normal HTML forms), but the whole thing is within the server form, only they don't
have a runat attribute.

Regards,
Emilio

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
User controls should generally not contain Form tags, or else it causes problems like you're describing.
Other details:
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.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.now> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
> Hi,
> As you all know when an ASP.NET web form is created that will
> include web controls and such, it contains a
> FORM that that identifies the web form and its containing controls.
>
> Well, I have a web form who has several other (user & custom) controls,> these are enclosed within the standard
> FORM tag. Additionally *some* of these user controls are actually forms> as well. This results into nested Forms.
>
> I was noticing that this seems to cause certain confusion on the
> browser sometimes. I checked the HTML and it is ok.
>
> It has the following forms:
> 1. ASP.NET Web Form tag (Form1)
> 2. Login form (Login)
> 3. Google search form (Google)
> 4. PayPal form (PayPal)
>
> 2 through 4 are obviously embedded into the #1 form. On FireFox I
> notice that one of the forms is not reported by the PageInfo dialog
> (very handy tool). I reported it as a bug there but I wonder if this
> actually causes problems with ASP.NET. Why? because when the order of
> my forms were 1, 4, 2, 3 and I had a user control that had a form as
> well (that would have been just the ASP.NET web controls without FORM
> tag because it is always contained in #1) then the "Submit" button
> would no longer work.
>
> Strange... Now in the order shows above (1.2.3.4) the submit button
> works (you can click and it posts back). Any ideas?
>
> Thx
> Emilio
>



Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2623
by: Jeff Thies | last post by:
Sometimes I may have one form nested inside the other (this is an editable page). <form name="form1"> <form name="form2"> </form> <input type="text" name="form_element_for_form1"> </form>
0
1368
by: Jamie | last post by:
Just thought i'd post this tip for developers who are having problems submitting HTML forms which reside inside a parent ASPX web form. basically, HTML forms wont submit correctly if they're inside an outer form. this is obviously a relevant issue with ASPX as webcontrols need to reside inside a server side form. i found a work around...
2
3180
by: pk | last post by:
Let me start off by mentioning that I'm not a web developer by any means. I welcome any and all tips regarding code cleanliness and would love to hear about any conventions that I'm breaking. I have a page here that I've broken down to its simplest (that i know of) elements so it is easier for you guys to follow along. ...
1
1761
by: oncewaswillow | last post by:
Hi, I have 3 nested forms and want to calculate a total on the first subform (as the form loads)by adding 2 fields from that form + to a field on the second subform. Second subform is and control is Sumpd. I use this =.Form!Sumpd++ which works well as long as the transactiontbl subform has records in
10
3197
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our complexity analyzer tool supposedly does not pick it up. Is it really more efficient? Personally I find this coding style extremely cryptic, misleading...
12
3525
by: upernikaw | last post by:
Hello, I am attempting to create a nested loop (in Access 2003/VB) that will print a report for a set of user defined months inputed on a form and that will print out for every Client. So the first loop would increment the Client by 1, then the second loop would increment the Month by 1. So the first time around Client A for Month 1, then...
8
6393
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains the combo box. The fields I am working with are date fields that are formated as Short Date. I have written an IIF statement and placed it within the...
8
3023
by: =?Utf-8?B?QW1yaXQgS29obGk=?= | last post by:
Okay, after much research, I have discovered a few interesting things in ASP.NET. I have a MasterPage that has a WebForm on it and it looks like this: <body> <form id="controls" runat="server"> <div id="bodyColumn"> <asp:ContentPlaceHolder id="bodyContentPlaceHolder" runat="server"> </asp:ContentPlaceHolder>
4
2657
by: Patrick A | last post by:
All, I rely on nested IF statements with multiple conditions heavily, and someone suggested recently writing the statements (and especially reading them months later) would be much easier if I used Case statements instead. I've read several different examples of Case statements, but can't quite figure out the syntax, or if they can be...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.