Take total control over the head tag in ASP.NET

by timvasil 10/22/2008 2:44:00 AM

When you use the tag, such as on a master page, the HtmlHead control does the rendering work. The results are pretty dreadful; spacing is pretty screwy for one thing. But that's something I can live with.

One thing I can't live with, however, is third party components like DevExpress adding bogus (and redundant!) stylesheet links within the head tag! I wanted to take control of that tag to filter out these tags, but found HtmlHead to be a sealed class. I can't tell you how many times I've tried to correct bad behavior through the well-established OO practice of inheritance only to find a "sealed" wall in my way. Personally, I think that keyword needs to go! But, alas, in this case there is a way to get around the constraint.

I didn't realize this until today, but ASP.NET has a mechanism for overriding how a control renders its content, even if that control is sealed. The magic is in browser adapters. I learned all about it here:

Tags:

ASP.NET

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Search

Calendar

«  May 2013  »
SuMoTuWeThFrSa
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Recent posts

Recent comments

Archive