Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > System.Web.UI.WebControls.Adapters.MenuAdapter

Reply
Thread Tools

System.Web.UI.WebControls.Adapters.MenuAdapter

 
 
Dittrich
Guest
Posts: n/a
 
      07-04-2007
I have a question about the System.Web.UI.WebControls.Adapters.MenuAdapter.

I want to use the default asp.net 2.0 menu on my website, with one little
addition. I want the rendered html to include an id-tag for each anchor (a)
tag that is rendered by the menu control. My first thought was to use a
browser file for this and define a menuadapter class in here. In the
menuadapter class, override the RenderItem method to include the extra id
tag. Something like this:

public class MenuAdapter : System.Web.UI.WebControls.Adapters.MenuAdapter
{
public MenuAdapter() : base()
{
}

protected override void RenderItem(HtmlTextWriter writer, MenuItem
item, int position)
{
writer.AddAttribute("id", item.Value);
base.RenderItem(writer, item, position);
}
}

This doesn't work however. When I use a menuAdapter class, only the toplevel
menu links are rendered, submenus don't pop out any more and the toplevel
links include the word "Expand". When I look at the html rendered, I noticed
a Webresource.axd file missing from the source.

My question: Does anyone know of a good example of using a MenuAdapter
class? One that is really simple (so not the one from the CSS friendly
control adapters) which uses most of the original functionality? I can't
seem to find much documentation on this subject.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments