Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Menu control - problem with setting selected item

Reply
Thread Tools

Menu control - problem with setting selected item

 
 
Eirik Eldorsen
Guest
Posts: n/a
 
      07-28-2006
I can't figure out how to set that an level1 and level2 item is selected at
the same time. Is this not possible?

Here is my code that set selected item:

private void UpdateMenu()
{
foreach (MenuItem n1 in mMeny.Items)
{
if (Convert.ToInt32(n1.Value) == selectedLevel1ID)
{
n1.Selected = true;
}
foreach (MenuItem n2 in n1.ChildItems)
{
if (Convert.ToInt32(n2.Value) == selectedLevel2ID)
{
n2.Selected = true;
}
}
}
}


The code seems to run as expected when I debug, but the generated html code
dosen't set selected on level1, when an item on level2 is selected.


Eirik


 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu control a step behind on Selected Item Leslie ASP .Net Web Controls 4 05-12-2008 07:53 PM
asp:Menu control - setting the style of the selected item in the navigation RJN ASP .Net 0 03-15-2008 05:50 PM
Menu Control - Selected Item Style - Background image showing twice IntraRELY ASP .Net Web Controls 0 06-08-2007 11:27 PM
How do I set selected Menu item in a asp:menu control? goran.strand@gmail.com ASP .Net 0 12-22-2006 08:05 AM
In Menu Control's item collection, setting .Selected=false doesn't work if children present Wayne Erfling ASP .Net 0 10-13-2006 01:24 PM



Advertisments