Back in the days of Web Forms, there were server controls, and they generated rather CSS-unfriendly HTML. So, Microsoft got someone (Russ Helfand) to write adapters that changed their rendering to be more CSS-friendly: the “CSS Friendly Control Adapters” were born.
A little less farther back, in 2007, I tried convincing some people at Microsoft to let the community continue development of these adapters, and they agreed. The CSSFriendly CodePlex project was born, and a bunch of bugs and some new features were added.
A lot has changed since then, but the adapters still have use today for people stuck on .Net 2.0 (they’re in the top 200 most downloaded CodePlex projects, and their forums still see activity). To facilitate those who still use CSSFriendly, I’ve added the library package to NuGet.
How to use the CSSFriendly NuGet package
In four easy steps (three if you already have NuGet).
- First, you need Visual Studio 2010 and NuGet. (If you’re new to NuGet, read the getting started documentation.)
- Next, right-click the References folder and choose Add Library Package Reference.
- In the Add Library Package Reference window, search for “cssfriendly.”
- When you see the CSSFriendly package, click the Install button.
After it installs, the following is added to your project:
- The CSSFriendly library reference
- The CSSFriendlyAdapters.browser file in the App_Browsers folder
At that point, you’re ready to go!
The full source of the CSSFriendly library is still available at CodePlex: http://cssfriendly.codeplex.com. Downloads there include sample code and walkthroughs.
Enjoy, and let me know if you have any issues!
Henry Wyckoff says:
I have been reading into css friendly control extenders — in particular menu and treeview.
I am trying to use asp:menu to produce a clean UL without any classnames or styles. Just a clean UL so smartmenus can do its magic as designed.
I’ve looked at the existing examples for CSS friendly and didn’t see a rendered UL without classes and styles. Maybe I just saw an old version?
Anyway, I was hoping you might be able to point me in the right direction. I’ve posted questions on asp.net forum and stackoverflow but nobody’s bit yet.
Thank you