开发者

HTML controls in VisualStudio.net

What is the purpose of providing HTML contro开发者_开发技巧ls with VS.net? Why would someone choose to use HTML controls over .net web server controls?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜