ASPNET 2.0 do I need to put everything inside <div>

We know we need to put inside the <form> element, because the ASP
control needs postback.

If a particular ASP control doesn't need postback, it doesn't really
need to be inside the <form> element.

Now, why there is a <div> element inside the <form> and it seems to me
that everybody is putting their ASP controls in it.

Thanks in advance.
ckkwan [ Di, 08 April 2008 15:07 ] [ ID #1937748 ]

Re: ASPNET 2.0 do I need to put everything inside <div>

You don't have to put your controls inside a <form>. Not 100% sure on the
rules, but individual controls that need the viewstate seem to error if
placed outside the <form>. However you can put custom controls outside the
<form>.

In above I assume <form> is a server-side form with runat="server"

If you want to use non-ASP controls you can put them outside the form, or
you can even have multiple forms on the page as long as only one has
runat="server" and they are not nested.

You don't need to put your controls in the <div> either, you can delete it,
it is just part of the blank page template.

<ckkwan [at] my-deja.com> wrote in message
news:6752a7ac-77a8-4fe8-8e3b-851201934704 [at] r9g2000prd.googleg roups.com...
> We know we need to put inside the <form> element, because the ASP
> control needs postback.
>
> If a particular ASP control doesn't need postback, it doesn't really
> need to be inside the <form> element.
>
> Now, why there is a <div> element inside the <form> and it seems to me
> that everybody is putting their ASP controls in it.
>
> Thanks in advance.
>
Aidy [ Di, 08 April 2008 15:41 ] [ ID #1937753 ]

Re: ASPNET 2.0 do I need to put everything inside <div>

On Apr 8, 7:41=A0am, "Aidy" <noem... [at] noemail.xxx> wrote:
> You don't have to put your controls inside a <form>. =A0Not 100% sure on t=
he
> rules, but individual controls that need the viewstate seem to error if
> placed outside the <form>. =A0However you can put custom controls outside =
the
> <form>.
>
> In above I assume <form> is a server-side form with runat=3D"server"
>
> If you want to use non-ASP controls you can put them outside the form, or
> you can even have multiple forms on the page as long as only one has
> runat=3D"server" and they are not nested.
>
> You don't need to put your controls in the <div> either, you can delete it=
,
> it is just part of the blank page template.
>
> <ckk... [at] my-deja.com> wrote in message
>
> news:6752a7ac-77a8-4fe8-8e3b-851201934704 [at] r9g2000prd.googleg roups.com...
>
>
>
> > We know we need to put inside the <form> element, because the ASP
> > control needs postback.
>
> > If a particular ASP control doesn't need postback, it doesn't really
> > need to be inside the <form> element.
>
> > Now, why there is a <div> element inside the <form> and it seems to me
> > that everybody is putting their ASP controls in it.
>
> > Thanks in advance.- Hide quoted text -
>
> - Show quoted text -

Putting your controls inside a <div> element is recomended.
The nice thing about <div>s is that you can use a StyleSheet!
This makes formating and mantainence very easy.

Steve
Steve Kershaw [ Mi, 09 April 2008 00:01 ] [ ID #1937842 ]

Re: ASPNET 2.0 do I need to put everything inside <div>

Thanks for the info.

If it is just because of CSS, then I think I can afford to do without
it. It is not difficult to add the <DIV> later when I really need to
format the entire page with CSS. :)

On Apr 9, 6:01=A0am, S_K <steve_kers... [at] yahoo.com> wrote:
> On Apr 8, 7:41=A0am, "Aidy" <noem... [at] noemail.xxx> wrote:
>
> Putting your controls inside a <div> element is recomended.
> The nice thing about <div>s is that you can use a StyleSheet!
> This makes formating and mantainence very easy.
>
> Steve- Hide quoted text -
>
> - Show quoted text -
ckkwan [ Mi, 09 April 2008 02:55 ] [ ID #1938580 ]

Re: ASPNET 2.0 do I need to put everything inside <div>

AFAIK this is a compliance issue. My understanding is that an inline tag
should be inside a container block tag. The form just defones the behvaior
for inner fields and is not considered as a container. Or something
similar...

Try to validate once the tag is removed to see if it sill passes...

--
Patrice


<ckkwan [at] my-deja.com> a écrit dans le message de news:
0031ddb0-42cc-4b82-afe5-7e7ced275f22 [at] q24g2000prf.googlegroup s.com...
Thanks for the info.

If it is just because of CSS, then I think I can afford to do without
it. It is not difficult to add the <DIV> later when I really need to
format the entire page with CSS. :)

On Apr 9, 6:01 am, S_K <steve_kers... [at] yahoo.com> wrote:
> On Apr 8, 7:41 am, "Aidy" <noem... [at] noemail.xxx> wrote:
>
> Putting your controls inside a <div> element is recomended.
> The nice thing about <div>s is that you can use a StyleSheet!
> This makes formating and mantainence very easy.
>
> Steve- Hide quoted text -
>
> - Show quoted text -
Patrice [ Mi, 09 April 2008 10:34 ] [ ID #1938594 ]

Re: ASPNET 2.0 do I need to put everything inside <div>

I checked the exact reason.

This is because whatever you show must be inside an inline or a block
element. Similarly you can't use
....<body>SomeText</body>... you have to wrap SomeText inside for example a
span or a div....

--
Patrice

"Patrice" <http://www.chez.com/scribe/> a écrit dans le message de news:
eFLwUyhmIHA.484 [at] TK2MSFTNGP06.phx.gbl...
> AFAIK this is a compliance issue. My understanding is that an inline tag
> should be inside a container block tag. The form just defones the behvaior
> for inner fields and is not considered as a container. Or something
> similar...
>
> Try to validate once the tag is removed to see if it sill passes...
>
> --
> Patrice
>
>
> <ckkwan [at] my-deja.com> a écrit dans le message de news:
> 0031ddb0-42cc-4b82-afe5-7e7ced275f22 [at] q24g2000prf.googlegroup s.com...
> Thanks for the info.
>
> If it is just because of CSS, then I think I can afford to do without
> it. It is not difficult to add the <DIV> later when I really need to
> format the entire page with CSS. :)
>
> On Apr 9, 6:01 am, S_K <steve_kers... [at] yahoo.com> wrote:
>> On Apr 8, 7:41 am, "Aidy" <noem... [at] noemail.xxx> wrote:
>>
>> Putting your controls inside a <div> element is recomended.
>> The nice thing about <div>s is that you can use a StyleSheet!
>> This makes formating and mantainence very easy.
>>
>> Steve- Hide quoted text -
>>
>> - Show quoted text -
>
>
Patrice [ Mi, 09 April 2008 13:20 ] [ ID #1938609 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » ASPNET 2.0 do I need to put everything inside <div>

Vorheriges Thema: Using InnerHtml to build up div
Nächstes Thema: Visual Studio 2003 blowing chunks