I don’t use many (actually, I try not to use any) of the built-in styling properties of ASP.NET server controls. The only property that means a thing to me is CssClass
. However, there are a few properties I find I always have to set to avoid crummy markup. Chief amongst these is the GridView
’s GridLines
property – if you don’t set this to ‘None’ and CellSpacing
to -1, CSS styling of grid borders isn’t possible as inline styles will override any of your stylings.
I don’t really theme sites either, largely because of the aforementioned bad markup – the presentational properties result in a slew of inline styles applied to many elements which bloats the HTML. Since I’m not using them for anything else, a single ‘Default’ theme’s skin files actually works very well as “policy” style document. I always set these two properties on any GridView
- now I can set them once in a ‘Default’ theme and every GridView
I use will inherit the policy. Not precisely what themes were intended for, but pretty useful nonetheless (at least until ASP.NET Control Adapters arrive later this month)