1.6 Creating Cleaner HTML Output with CSS Friendly Control Adapters
ASP.NET’s controls are wonderful things. They save developers vast amounts of time by providing well-tested, robust, and rich-featured controls for creating everything from menus to data lists.
Unfortunately, the HTML these controls generate isn’t particularly easy to work with if you’re trying to get the most out of CSS. For example, ASP.NET’s Menu control dynamically binds data from an XML file or database, creates the menu, and outputs it using HTML table elements. This can be quite frustrating, especially if you’re in the web standards camp, where using tables for layout is considered evil.
The CSS Friendly ASP.NET 2.0 Control Adapters not only win the award for the longest tool name in this book, they also help solve this problem. The package, created by Microsoft’s ASP.NET team, lets you generate much nicer HTML output by injecting custom control adapters into the flow just described.
CSS adapters exist because too many developers were dissatisfied with the control they had over how the stock ASP.NET controls rendered HTML. A prime example of this is the recent movement to use ul tags rather than table tags for creating menus. Well-known CSS guru Eric Meyer has talked about this approach in his article “Pure CSS Menus,” which is posted at his web site (http://www.meyerweb.com/eric/css/edge/menus/demo.html).
|
|---|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
