开发者

Controlling HTML of a WebPart's top-right drop down menu

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 S开发者_如何转开发prites 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜