Choosing controls and utilising CSS Friendly Control Adapters

by andrew 8/23/2007 12:41:18 AM

When do you decide it is time to give up on using some of the more feature rich ASP.NET controls? When is it easier and/or quicker to code something yourself?

I spent yesterday trying to plug the CreateUserWizard into an e-commerce website. It was very simple to get working and very little code was required. However once I got it working, I then had the interesting task of getting it to produce the required HTML. I edited the templates; getting rid of the entire messy table based HTML, and thought everything was going good. It wasn't.

When I loaded the registration page up in Firefox, and viewed source, I could see the nice template HTML was surrounded by more hideous HTML that the CreateUserWizard had generated. The hideous HTML was not part of a template so could no be changed.

After googling around I found a very exciting discovery - the ASP.NET CSS Friendly Control Adapters. A set of adapters that can be dropped into an application and will help adapt the HTML that the ASP.NET controls render, making them CSS friendly.

I wired up the adapters and loaded up my site in Firefox, and then viewed source. Woo hoo, the HTML was fixed, with not a table to be seen.

But then another pothole....

I tried to create a user and hit all sorts of problems. After a bit of debugging, I found out that when the adapters are plugged in, the CreateUserWizard doesn't quite work the same. My event handlers were not working because the properties such as UserName on the CreateUserWizard were empty! I ended up having to use FindControl to get the values that I needed instead of accessing the properties. I have since found Steven Harman's excellent blog post - CSS Friendly Control Adapters, CreateUserWizard, and ViewState... Oh My! - that covers this in more detail.

Okay, so I tweaked my code and everything seems to be working again, but from reading more about Steven's experiences it seems like there may still be some outstanding issues with the CreateUserWizard and the CSS Friendly Control Adapters.

Which brings me to the question at the beginning of the post - When do you decide it is time to give up on using some of the more feature rich ASP.NET controls?

With the CreateUserWizard as an example, there are ways of making it behave properly in terms of the HTML it renders but when do you draw the line? The CSS Friendly Control adapters are a very useful development, but when they affect the behaviour of a component and introduce quite a lot more complexity is it worth the cost?

What have I gained? In this case with the Membership/Profile providers, it would be quite easy to develop a bespoke control.

Any thoughts?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Comments

8/15/2008 5:43:37 AM

Furiant

I'm looking into the CSS-Friendly Control Adapters project now - thanks for the link.

It's a shame that Microsoft puts all this effort into creating these, and then gimps them so badly with the abominable HTML that no serious web developer would consider using them. I am sorely disappointed with their utter refusal to acknowledge contemporary design and accessibility best practices.

Furiant us

9/7/2008 12:27:32 PM

seo


It's a shame that Microsoft puts all this effort into creating these, and then gimps them so badly Thank you

seo tr

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

9/7/2008 12:07:25 PM

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author Andrew Rimmer
Software Architect based in London

E-mail me Send mail

Calendar

<<  September 2008  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Authors

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in