views:

38

answers:

1

What is the purpose of providing HTML controls with VS.net? Why would someone choose to use HTML controls over .net web server controls?

+3  A: 

ASP.NET Server Controls generally are more polished and abstracted, behaving more like controls in the Windows Forms API. HTML controls are more bare-bones, with less abstractions to store state and a more raw interface to adding attributes.

HTML controls can be included in a page as just plain text tags that the ASP.NET processor outputs exactly as they are written. They can also be set to be processed by ASP.NET by adding a runat="server" attribute to any HTML tag. Once you add this attribute and give an HTML control an ID, you can access it programmatically.

Using one or the other is really a matter of style or preference. The key thing to keep in mind is that you shouldn't use one or the other exclusively. I've worked at places where developers say "always try to use the ASP.NET controls" and other places where developers say "avoid ASP.NET controls whenever possible". There are no really strong arguments, at least that I can think of, that give definite examples of why one or the other should be used exclusively.

Dan Herbert
Thanks for your info.
LearningCSharp