0

im using menu item as my navigation. and im using this to remove my menu.

Private Sub RemoveItemByValue(ByVal Value As String)
               For i As Integer = 0 To Menu1.Items.Count - 1
            If Menu1.Items(i).Value = Value Then
                Menu1.Items.Remove(Menu1.Items(i))
            End If

        Next
    End Sub

but i can only remove the top menu. but i want to remove the sub sub menu item.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mIssy_ricco
0

Try to use Menu.FindItem method to search a menu item.

Assume that a menu has the following structure
Home->Music->Classical
Home->Music->Rock

Here Music has two sub menu items.

To remove the 'Classical' sub menu item from 'Music', use the following code

String valuePath1 = "Home/Music";
        MenuItem musicMenuItem = Menu1.FindItem(valuePath1);
        String valuePath2 = "Home/Music/Classical";
        MenuItem item = Menu1.FindItem(valuePath2);
        musicMenuItem.ChildItems.Remove(item);

Edited by Ramesh S: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.