About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

CSS Friendly Adapters - Using Comments in your Browser File can be Touchy

If you're using CSS Friendly Control Adapters to get some of your asp.net 2.0 controls under control - at least when it comes to the markup they render - be careful when adding comments to the CSSFriendlyAdapters.browser file.

The .browser file is an XML formatted file that the asp.net runtime uses to configure what adapter(s) gets attached to which framework control(s). And as some of you may be aware, there are some known issues with using the CSS Adapters with some of the new Login controls.

One common solution work around is to disable the CSS Adapters for the controls that are giving you problems. The easiest way to do that is to comment out the adapter's line in the CSSFriendlyAdapters.browser file. But you've got to be careful to comment out each line individually, rather than relying on a block comment.

The wrong way

<adapter controlType="System.Web.UI.WebControls.LoginStatus"
    adapterType="CSSFriendly.LoginStatusAdapter" />
<!-- <adapter controlType="System.Web.UI.WebControls.CreateUserWizard"
    adapterType="CSSFriendly.CreateUserWizardAdapter" /> -->
<adapter controlType="System.Web.UI.WebControls.PasswordRecovery"
    adapterType="CSSFriendly.PasswordRecoveryAdapter" />

The correct way

<adapter controlType="System.Web.UI.WebControls.LoginStatus"
    adapterType="CSSFriendly.LoginStatusAdapter" />
<!-- <adapter controlType="System.Web.UI.WebControls.CreateUserWizard" -->
<!-- adapterType="CSSFriendly.CreateUserWizardAdapter" /> -->
<adapter controlType="System.Web.UI.WebControls.PasswordRecovery"
    adapterType="CSSFriendly.PasswordRecoveryAdapter" />

It seems that the framework doesn't respect the block comment, and when I tried using oneĀ  (like in the wrong way example above) I ended up with both the CreateUserWizard and the PasswordRecovery adapters disabled.

Maybe it was just me, but itsĀ better to be on the safe side and save yourself from having to crack your keyboard over your head.

Related Posts

What others are saying.

# CSS Friendly Adapters - Using Comments in .browser File can be Touchy
Gravatar DotNetKicks.com
Apr 18, 2007
You've been kicked (a good thing) - Trackback from DotNetKicks.com
Comments have been closed on this topic.