Difference between Html Element and Web Controls

S

SAI

Both have "TextBox" element and "Runat server". I don't understand the
difference. Please advise. Thanks.
 
M

Martin Honnen

SAI said:
Both have "TextBox" element and "Runat server". I don't understand the
difference.

ASP.NET tries to provide controls that are close to the HTML elements
and the client-side browser object model (the HtmlControls) and controls
which are close to the API Windows developers are used to from WinForms
GUI development.
There is some overlapping functionality that way and it is up to you to
decide what you prefer.
 
S

Scott M.

Not quite.

There are actually 3 "families" of controls to choose from:

HTML Controls are standard HTML controls that have been a part of the HTML
language for years. These are not classes, they are tags and you can only
do client-side programming with them.

HTML Server Controls are the exact same as above but have: runat="server"
added to them. These controls add server side programmatic capabilities to
the otherwise standard HTML Control. Use these controls when migrating old
web applications to .NET applications.

Web Form Controls (a.k.a. Server Controls) are .NET Classes that expose a
rich set of properties, methods and events. They are programmable on the
client and/or the server. There are some that offer the same UI as HTML
Controls but have more features and there are some that offer a much richer
UI that would take quite a bit of programming if they were to be made in
standard HTML from scratch (i.e. Calendar Control, DataGrid Control,
Validation Controls). All of these controls render to the client as HTML
and/or CSS and/or JScript. Use these when rich UI's and/or rich
programmatic capabilities are needed.
 
J

Juan T. Llibre

Take a look at the list of their classes :

HTML Controls :
http://www.csharpfriends.com/quicks...ser.aspx?namespace=System.Web.UI.HtmlControls

WEB Controls :
http://www.csharpfriends.com/quicks...wser.aspx?namespace=System.Web.UI.WebControls

You'll notice a LOT of differences.

Drilling down ( by clicking ) in the HTML controls to the HtmlInputControl:
http://www.csharpfriends.com/quicks...em.Web.UI.HtmlControls&class=HtmlInputControl

will show you the differences between that control and the Textbox web control:
http://www.csharpfriends.com/quicks...space=System.Web.UI.WebControls&class=TextBox

There's some crossover between web controls and html controls,
but the differences between them are many.

Keep those links handy whenever you need to know the
difference between any other controls supplied both by

System.Web.UI.HtmlControls
and
System.Web.UI.WebControls
 
E

Eliyahu Goldin

Html and web controls inherit from different parents and have different sets
of properties, methods and events. If you need any sort of functionality
specific for web controls, use them. Otherwise use html ones, they are
lighter.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top