Runat=server Vs. asp controls
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngbeta' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Paritosh V. Mhaisekar
which one is better... a normal HTML control having attribute runat=server
... or to use pure aspcontrol???
cheers
paritosh

Reply to this message...
 
    
Andy Smith (VIP)
it depends :)

the html controls are designed so that the render exactly as an html guru =
would expect. They are basically wrappers for the standard html controls =
you would use with normal html pages, except you can now change the =
attributes from server-side events. ( These are for people who prefer a =
car with a standard transmission )

the web controls are designed so that they render however is appropriate =
for the current browser level. They have a whole lot of built-in functional=
ity, and really seperate the designer from the final html. ( These are for =
people who prefer the automatic transmission. )

Neither is "better" than the other, really... It just depends on what you =
want.

Andy Smith
Staff Programmer
Harding ESE

    -----Original Message-----
        From:    Click here to reveal e-mail address=20
Sent:    Tuesday, May 08, 2001 10:08 AM
To:    "aspngbeta" <Click here to reveal e-mail address>
Subject:    [aspngbeta] Runat=3Dserver Vs. asp controls
=09
which one is better... a normal HTML control having attribute runat=3Dserve=
r
... or to use pure aspcontrol???
cheers
paritosh

| [aspngbeta] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngbeta.asp =3D JOIN/QUIT

Reply to this message...
 
    
Mauricio Di Bonifacio
WebControls have a better and more consistent object model.
The controls are function based, and not interface based like Html controls.
For example, to input text, you can use a TextBox control, and according you
set the properties, it can render a <input type="text">, a <input
type="password"> or even a <textarea> Html element.

Mauricio Di Bonifacio
Vertis Tecnologia
Diretor
+55 11 3887 0835
http://www.vertisnet.com.br

----- Original Message -----
From: "Paritosh V. Mhaisekar" <Click here to reveal e-mail address>
To: "aspngbeta" <Click here to reveal e-mail address>
Sent: Tuesday, May 08, 2001 12:08 PM
Subject: [aspngbeta] Runat=server Vs. asp controls

[Original message clipped]

Reply to this message...
 
    
Stuart C. Salsbury
Regarding controls declared with runat="server" versus "pure asp
controls".... I'm not sure there is much of a difference between the two
(other than that one of the controls (the one with runat="server") is
declared from a designer file (.aspx or .ascx) and the other (by the only
info you've given) seems to be a code-declared control.

If I'm not mistaken about your brief question, it is likely that you'll get
roughly the same thing whichever way you choose to declare and locate the
control in its host (probably a page host). That is to say, controls
declared in an .aspx (or .ascx) file are utlimately going to feel and behave
just like the controls that aren't declared in the designer file (but rather
in your code-behind file). However, you have to do more dirty work to do
code-only, as you don't get the help of the designer's runtime helpers (the
things that make designer-based pages and controls able to extend their
code-behind base classes).

It may be relevant and important to understand that an .aspx file is
actually a (loosely interpretted) XML-based way of deriving a page from the
code behind class that it fronts for. It's major use it to give you a
format in which to write typical HTML that has embedded server controls.

That is to say that (in the typical case) the class that comes from
YourPage.aspx inherits from the class that comes from YourPage.cs which
inherits from System.Web.UI.Page. Whether you choose to instantiate and
host your controls explicity in the class definedi in YourPage.cs or whether
you choose to instantiate and host your controls with pure code is a matter
of the degree to which you desire reusability, among other things. If your
page is going to get fancy about how it does its thing then code-only is
probably the way to go... if you're trying to get something coded quick,
then .aspx (designer) files are quite useful. IMHO, you write .net sites at
your peril if you don't learn the basics of code-only pages and controls.
Places to look for getting started: protected virtual Control.Render method,
protected virtual Control.CreateChildControls method (you override these to
define how your control (or page) generates HTML, and to define how your
control (or page) gathers its constituent controls (its contents),
respectively).

Regards,
Stuart Salsbury
Ernst & Young LLP

-----Original Message-----
From: Paritosh V. Mhaisekar [mailto:Click here to reveal e-mail address]
Sent: Tuesday, May 08, 2001 12:08 PM
To: aspngbeta
Subject: [aspngbeta] Runat=server Vs. asp controls

which one is better... a normal HTML control having attribute runat=server
... or to use pure aspcontrol???
cheers
paritosh

Reply to this message...
 
 
System.Web.UI.Control
System.Web.UI.Page
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com