views:

19

answers:

1

I am reviewing some existing ASP.NET code that used ASP.NET WebParts. The web parts implement IWebActionable in order to control the items shown on the web part's top-right drop down menu.

The rendered HTML for each context menu item looks something like this:

<DIV>
    <A class="menuItem" onclick="stuff" href="javascript:void(0)">
        <IMG src="something.gif"/>Menu text
    </A>
</DIV>

I want to use the CSS Sprites technique on the images used for the menu items. However, in order to do this I need to have some control over the rendered HTML, changing it to something more like this:

<DIV>
    <A class="menuItem thisItemCssSpriteClass" onclick="stuff" href="javascript:void(0)">
        Menu text
    </A>
</DIV>

Is this possible?

A: 

I found a solution - you need to customise the web part "chrome" by creating a class that inherits from WebPartChrome. The following article contains an example:

http://www.codeproject.com/KB/aspnet/webpartchrome.aspx

Richard Ev