View Single Post
  #5 (permalink)  
Old July 26th, 2007, 12:06 AM
AGS AGS is offline
Wrox Technical Editor
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2005
Location: Russia
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Shahram,

I can't agree with you. In my opinion, the text of the book states that one CAN'T USE html body and form tags in a user control.
Sorry if it is my English that is to blame but in your post above you use "shouldn't" but in the book the text is "can use except ..." which means "can't use" i.e. it apparently sounds like it is not technically possible. But it is not the case (see my example in the first post of the topic). I agree that for the most part it is not necessary but theoretically, for example, one can use footer user control which includes closing </body> or/and </html> tag, or user control which includes entire <form /> element.
And another difference between the text of the book and your post. In the book you use term "tag":
quote:...can use any HTML tag except for html ...
but in the post you use "element" term:
quote:...should not include html, body, and form elements
If you meant html body or form elements in the text of the book then there is another inaccuracy which is not acceptable in any professional book when these terms (tag and element) are used interchangeably.
But even in this case I can use ANY of the mentioned HTML elements (with their content) in a user control.

Of course it is not necessarily in ASP.NET 2.0 with its master pages mechanism, but it is still possible. As a part of my current project we have to use ASP.NET 1.1 and in the project custom templating xml-configured mechanism was designed where UserControls are used to create consistent layout. So upper-level user control contains html and body element, and lower-level user control contains form element (and user controls of lower levels) and there is nothing wrong with it.

And another final argument closely related to ASP.NET 2.0. Isn't MasterPage class derived from UserConrtol? Do you mean that I can't use html body or form element in a master page or in any nested master page?

So, once again, as far as parser can build parse tree from the markup the user control is valid.
Thus I can't agree that there is no technical inaccuracy in the mentioned paragraph.

Best regards,