0

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

1
  • You are referring to using say, the ASP.NET image control vs. an <img> tag with the runat="server" attribute? Commented Jan 31, 2010 at 4:16

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.