My musings about .NET and what not

CSS Friendly Control Adapters -- Dead?

It's now coming up on two years since the release of Microsoft's ASP.NET CSS Friendly Control Adapters. Remember them?

Well, 1.0 is still the "official" production release, but at some point Microsoft handed over the keys and the whole shebang was moved to CodePlex, where it seems a lot of good ideas go to die.

One of the biggest gripes Web designers have always had with ASP.NET server controls is that some of them don't render semantically meaningful or accessible HTML. For example, the TreeView is rendered by default using

tags, but rightly a TreeView should be based on an unordered list(
    ). Same with the Menu control. And many of the rich databound controls (DataList, DetailsView, FormView etc.) and Membership controls (Login, CreateUserWizard, etc.) use tables in their markup as well. You can usually skate around a lot of the default table rendering mess by using templates -- but not altogether, as the entire control will always be surrounded by an enclosing table no matter what.

    The CSS Friendly Control Adapter project promised to change all that, by rendering proper semantic and table-free markup that would be easy to style with CSS. And it succeeded -- well, more or less. It still wasn't exactly "easy" to wrangle the convoluted CSS class rules, but at least it was now possible. And of course, there were the inevitable bugs accompanying any 1.0 release. Still, many of us muddled through as best we could. I was able to use the TreeView and a couple of the Membership controls in a few projects, and they worked fairly well.

    The biggest caveat when using the CSS FCAs with templated controls is that they simply do not work with templates period. If you want to template your Membership controls, for instance, forget it. Not happening. Of course, this leaves you with a few not-so-hot options:

    • Skip the templates and just use the default output from the CSS FCAs. This is fine as long as you don't have to add any additional controls or markup not provided for in the server control's exposed properties. But of course, isn't that what you're probably using templates for anyway?
    • Skip the CSS FCAs and just template everything (including the navigation rendering), and live with that last enclosing table.
    • In the case of certain controls (I'm taking mostly about the Membership controls in particular), build the UI from scratch and leverage the Membership and MembershipUser classes directly in code -- you know, all that tedious BS that the Membership controls were supposed to be saving you from in the first place.

    Well, like I said, it's going on two years and we're still stuck on 1.0, we're no closer to an updated version that actually works, and it doesn't appear as though there are more than one or two guys working on the CodePlex project part time. Don't get me wrong -- I'm certainly not blaming them. I'm sure they're doing the best they can. It's Microsoft that pretty much killed this baby in the crib by withdrawing its support.

    Sure, the CSS Friendly Control Adapters seemed like a good idea at the time, but in were in effect a hack designed to patch over the real issue -- that is, Microsoft needs to redesign their server controls to emit accessible, semantically meaningful, layout-table-free markup from the get-go. In my opinion, they really dropped the ball by not doing this in ASP.NET 3.5. If that had meant retaining some legacy 2.0 server control versions alongside their 3.5 counterparts, so be it. I can understand needing to maintain backward compatibility with 2.0 and not wanting to break existing sites. But that's no reason to hobble designers who have long since abandoned layout tables.

    Isn't it about time Microsoft stopped kicking this can down the road? I mean come on, it's 2008 for chrissake. Is lean, mean, and meaningful HTML from ASP.NET server controls too much to ask for at this point? If you ask me, it's an idea whose time is long overdue.

    Subscribe to this blog for more cool content like this!

    kick it on

    shout it on

    vote it on

    Bookmark / Share

      » Similar Posts

      1. 10 Reasons ASP.NET Webforms (Still) Rock
      2. Open Source or Die – The *Real* Future of Graffiti?
      3. How to Write a Good Accessibility Statement

      » Trackbacks & Pingbacks

      1. It's now over two years since the release of Microsoft's ASP.NET CSS Friendly Control Adapters. Remember them? Well, 1.0 is still the "official" production release, but at some point Microsoft handed over the keys and the whole shebang was moved to CodePlex

        CSS Friendly Control Adapters -- Dead? — December 9, 2008 10:33 PM
      Trackback link for this post:

      » Comments

      1. Soeren avatar

        Great post. Lee. Couldn't agree more. I've had many problems with this, and it is almost impossible to find good support for this on the net. This shows how little focus there is on this subject. I've read that Microsoft is looking at this for .NET 4.0 though, but let's see.

        About using the template option with CSS FCA's. I tried adding a create user wizard, and convert it to a template. I replaced the tables with semantic html instead, and when I ran the project and chose "View source", the whole deal was wrapped in a table, just as you said. But when I added the CssFriendly.dll and the CSSFriendlyAdapters.browser to my project, the wrapping table was replaced with a div. Same thing with the Login control. No tables in my controls rendered html now. I haven't had any problems with it yet, so it seems to work. Are there any specific problems you are aware of?

        By the way, thanks for your help on the Wrox forum. My user name is philthy...

        Soeren — November 19, 2008 3:23 PM
      2. Lee Dumond avatar

        I have tried just what you suggest on a few sites, with less-than-stellar results.

        I’ve gotten it to work with the Login control, but it’s not great on sites that have highly-customized functionality, because you lose the ability to conveniently reference data from child controls (like Logon1.UserName, etc), which means you’ve got to resort to using the FindControl method and casting, which is a big PITA.

        And the last time I tried it on a CreateUserWizard, it wouldn’t even render it on the page. This may be because I had added some preliminary steps to collect profile data up front, but who knows.

        And it seems that every "beta" release on CodePlex is buggier than the one before. I am really glad MS is looking into getting this right for 4.0, that is great news.

        Lee Dumond — November 19, 2008 4:23 PM
      3. Nestor Sulu avatar

        I totally agree, it's horribly frustrating, I'm supposed be using the latest technology by using .NET 3.5... yet cannot generate Search Engine friendly websites without having to code lot of lines myself... I'm feeling dissapointed of Microsoft sometimes, but well, let's see if they pay back in .NET 4.0

        2009, nobody use HTML tables nowadays! not if you consider your self professional! Hope .NET 4.0 is pure CSS + XHTML

        Nestor Sulu — June 4, 2009 12:04 AM
      4. Joel @ MMCC avatar

        It’s even worse now. It turns out that including the CSS Friendly Control Adapters version 1.0 causes any site using them under VS 2010 Beta 1 with .NET Framework 4.0 Beta 1 to blow up spectacularly.

        The tool-generated code produces these errors:

        Error 2 'System.Web.HttpBrowserCapabilities' does not contain a definition for 'AdapterGroups' and no extension method 'AdapterGroups' accepting a first argument of type 'System.Web.HttpBrowserCapabilities' could be found (are you missing a using directive or an assembly reference?) c:\WINDOWS\Microsoft.NET\Framework\v4.0.20506\Temporary ASP.NET Files\…\a423038e\d2c3a3d4\App_Browsers.z4xy5evt.0.cs (in Line 50)

        And again in lines 51, 53, 55, 57, 59, 61, & 63.

        I’ll try the latest CodePlex build and see if that remains the case. But if so, I’m up the creek, since I used these to do the navigation menus in my Website, and its very heavily dependent on them.

        Joel @ MMCC — August 1, 2009 10:36 PM

      » Leave a Comment