Where to put Form tag

T

tshad

I have pages that are identical except for the middle of the page to the
right where I do all my work.

<html>
<head>
</head>
<body>
<table>
<tr>
<td>
<table>
<tr>
<td>
<form>
<asp:...>
<asp:...>
...
</form
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

This works fine.

But now I need to add an <asp:Label> and maybe an <asp:textbox> just below
the <body> tag.

Do I need to move the <form> to just after the <body> and the </form> to
just before the </body>?

There is a lot of objects such as images and flash that will now be inside
the forms tag.

Is this going to be a problem? Will it slow the page down doing this?

Thanks,

Tom
 
P

Peter Bucher [MVP]

Hi Tom
Do I need to move the <form> to just after the <body> and the </form> to
just before the </body>?
Yes, as the autogenerated Site looks like in Visual Studio.
The whole Event System with the serverside controls build on the form
and needs them around.

[...]
<body>
<form....>
[All other Content goes here]
</form>
</body>
[...]
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Yes, you should adjust the form tags as you specified.
It's ok that a lot of other stuff will be in the form tags. If these
elements are not marked as runat="server" then they will have no effect on
performance.
 
T

tshad

That was what I figured,

Thanks,

Tom
Peter Bucher said:
Hi Tom
Do I need to move the <form> to just after the <body> and the </form> to
just before the </body>?
Yes, as the autogenerated Site looks like in Visual Studio.
The whole Event System with the serverside controls build on the form
and needs them around.

[...]
<body>
<form....>
[All other Content goes here]
</form>
</body>
[...]

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
 
T

tshad

Steve C. Orr said:
Yes, you should adjust the form tags as you specified.
It's ok that a lot of other stuff will be in the form tags. If these
elements are not marked as runat="server" then they will have no effect on
performance.

That makes sense.

I was always used to building my look and feel first and then started
putting my <form> tag around the area where my asp objects were which as
usually a cell in a table.

If there is no drawback that putting the form right after the body makes
more sense as it doesn't matter where on the page that I put some object
that may be outside of my normal work area.

Thanks,

Tom
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top