For quite some time now, I've been working on websites aiming for WCAG 2.0 compliance and 'clean' html output. Using .Net 2.0 this can be quit a challenge, since the .Net control output is anything but WCAG compliant and clean. Something had to be done to change the default .Net behaviour if we wanted to accomplish this compliance level, while benifiting as much as possible from the .Net controls collection. Over time, we have adopted some great techniques to get things done, which I will be sharing in this and upcoming blogposts (using masterpages, control adapters, javascript injecten, .browser files, custom html textwriters etc.).
But first i'll explain how to get rid of the annoying stylesection that .Net navigation controls add to your page header. Working on a site's navigational structure, we noticed that .Net was doing this, and we couldn't get rid of it! Since we want all styling to reside in external css files, this was really annoying us. There was NO WAY to fix this using control adapters. Below is an example.
<style type="text/css">
.ctl00_ctl00_LeftSidebarWirePlaceholder_LeftSidebarNavigationPlaceholder_TreeView1_0 { text-decoration:none; }
.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }
.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_1 { text-decoration:none; }
.ctl00_ctl00_PageHeadingNavigationPlaceholder_headernav_2 { }
</style>
After an endless search we discovered a neat little feature in the .browser file. Using the capabilities section, one can disable this behaviour.
<capabilities>
<capability name="supportsCss" value="false" />
</capabilities>
Hope someone will benifit from this!