Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ckkwan@my-deja.com - 08 Apr 2008 14:07 GMT
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 - 08 Apr 2008 14:41 GMT
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.

> We know we need to put inside the <form> element, because the ASP
> control needs postback.
[quoted text clipped - 6 lines]
>
> Thanks in advance.
S_K - 08 Apr 2008 23:01 GMT
> 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
[quoted text clipped - 26 lines]
>
> - 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
ckkwan@my-deja.com - 09 Apr 2008 01:55 GMT
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. :)

> Putting your controls inside a <div> element is recomended.
> The nice thing about <div>s is that you can use a StyleSheet!
[quoted text clipped - 3 lines]
>
> - Show quoted text -
Patrice - 09 Apr 2008 09:34 GMT
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

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...@yahoo.com> wrote:
> On Apr 8, 7:41 am, "Aidy" <noem...@noemail.xxx> wrote:
>
[quoted text clipped - 5 lines]
>
> - Show quoted text -
Patrice - 09 Apr 2008 12:20 GMT
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

> 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
[quoted text clipped - 22 lines]
>>
>> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.