Re: Controls v HTML

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"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
making things easier, they make themselves less flexible.
<snip>

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


.



Relevant Pages

  • Re: create html from flat file
    ... I want control over the html pages ie ... I was thinking maybe the flat file could use xml. ... a template file to indicate the controls that should appear on each ... create, html, xml, dynamic, template etc results in million+ hits. ...
    (comp.lang.php)
  • Re: create html from flat file
    ... I want control over the html pages ie ... I was thinking maybe the flat file could use xml. ... a template file to indicate the controls that should appear on each ... create, html, xml, dynamic, template etc results in million+ hits. ...
    (comp.lang.php)
  • Re: create html from flat file
    ... I want control over the html pages ie ... I was thinking maybe the flat file could use xml. ... a template file to indicate the controls that should appear on each ... create, html, xml, dynamic, template etc results in million+ hits. ...
    (comp.lang.php)
  • Re: Can a control produce html?
    ... the user controls HTML is not being grabbed. ... you have the problem that you want to fill the textarea on ... John Saunders ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: Controls v HTML
    ... System.Web.UI.ICallbackEventHandler you can talk to the server from client ... script and any html element can not do as any asp.net control. ... controls with JavaScript? ... > programmatically in an OOP fashion. ...
    (microsoft.public.dotnet.framework.aspnet)