Goal:
The label control adds <span> tags around the text when rendered, I needed to have these removed. I also show how to replace the <span> tag with whatever tag you would like.
I currently work on a site that has a custom built CMS, which is not always a good thing. Now don't get me wrong there are some great ideas in this home grown CMS, but just like any application there are some wrong/bad things as well. Here is one of those bad things that I had the time to fix recently.
The web site content is entered via a WYSIWYG editor by whoever is responsible for the content, this markup (from the WYSIWYG) is stored in the database along with flags/keys that determine when to display this content. If a few content items score the same then they all get built together, each one in its own Label control. This is all fine and dandy, but when it comes time to dynamically create this content and add it to the current page is when they go less than ok. Because of some limitations of the rest of the framework the content has to be built inside a System.Web.UI.WebControls.WebControl, ok this is fine except we are limited to a select few controls that fall into that category.
More...