Menu control - problem with setting selected item

E

Eirik Eldorsen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top