Re: Controls v HTML
- From: "Kevin Spencer" <unclechutney@xxxxxxxxxxxx>
- Date: Tue, 16 Oct 2007 11:51:53 -0400
"ThatsIT.net.au" <me@thatsit> wrote in message
news:49AA2E70-878C-4D55-A352-24C3224D71C6@xxxxxxxxxxxxxxxx
<snip>
I hardly see controls as intimidating, but clumsy, like many attempts at<snip>
making things easier, they make themselves less flexible.
Whatever your perception of ASP.Net Controls is, it is due to your
unfamiliarity with them, and with your unfamiliarity with the ASP.Net
programming paradigm. When used correctly, ASP.Net Controls do whatever you
want them to do, and very well.
Remember that ASP.Net Controls are not confined to the built-in set of
WebControls and HtmlControls that comes with the Framework, nor are they
limited to those plus User Controls. In fact, the ASP.Net platform is
designed with the idea in mind that you can and will create custom Controls
when needed. HTML elements in a web page are not necessarily unrelated to
one another, especially when they are interactive. They are more like parts
that can be combined to perform various tasks, much like the various
combinations of carpentry construction materials are combined to build
various types of buildings, and rooms in buildings.
A server-side web application takes this a step further, in that there are
also "parts" on the server that provide business logic, and "parts" that
provide a user interface in the form of an HTML document. These business
logic and UI logic parts comprise the actual application, while the HTML
document, with the sum of its parts, comprises a UI that communicates
transparently with the actual application on the server.
Remember that your original question was with regards to whether or not it
was better to employ Controls, or just "spit out HTML." Well, that is
exactly what Controls do. However, they are object-oriented, encapsulated,
and modular, which makes them superior to any procedural and/or non-modular
way of creating the various fragments of HTML markup that make up a
document.
In essence, System.Web.UI.Page is a Control that represents an HTML
document. It modelled after the HTML document object model, in that, like an
HTML document, it is a container for other Controls, just as an HTML
document is a container for other HTML elements. The ASP.Net object model
leverages the organizational and modular characteristic of the HTML document
object model to provide a similar server-side set of objects that are
self-contained and self-rendering.
Since the HTML document object model is not simply raw text, but a set of
encapsulated elements with various properties and functionality, it is best
to create server-side objects that do not treat the HTML in the page as raw
text, but as a set of encapsulated elements with various properties and
functionality. Yes, it is true that it is raw text that is interpreted by
the browser to render these elements, but in fact, even the browser simply
parses the text and builds an in-memory object hierarchy to work with. Once
the raw text has been parsed, it is ignored by the browser. ASP.Net hides
the raw text from the developer, giving the developer instead an object
model that closely resembles the resultant client-side model.
--
HTH,
Kevin Spencer
Microsoft MVP
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
.
- Follow-Ups:
- Re: Controls v HTML
- From: ThatsIT.net.au
- Re: Controls v HTML
- References:
- Controls v HTML
- From: ThatsIT.net.au
- Re: Controls v HTML
- From: Kevin Spencer
- Re: Controls v HTML
- From: Phil H
- Re: Controls v HTML
- From: ThatsIT.net.au
- Re: Controls v HTML
- From: Mike Placentra II
- Re: Controls v HTML
- From: ThatsIT.net.au
- Re: Controls v HTML
- From: Mike Placentra II
- Re: Controls v HTML
- From: ThatsIT.net.au
- Re: Controls v HTML
- From: Kevin Spencer
- Re: Controls v HTML
- From: ThatsIT.net.au
- Controls v HTML
- Prev by Date: Re: Inline C#: Mark with Attribute
- Next by Date: Re: Which Is the Object Here?
- Previous by thread: Re: Controls v HTML
- Next by thread: Re: Controls v HTML
- Index(es):
Relevant Pages
|