Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET 2.0 - MenuItem / MenuSubItem collection problem

Status
Not open for further replies.

joggi

Programmer
Nov 8, 2006
44
YU
I have asp master page with menu control like this:

MenuItem1
MenuSubItem1
MenuSubItem2
MenuItem2
MenuSubItem3
MenuSubItem4

I want some menu items and subitems to be disabled or enabled. I have code like this:

For Each menu In Menu1.Items
If menu.Value = "E" Then
menu.Enabled = True
ElseIf menu.Value <> "" Then
For i = 0 To UBound(x)
If menu.Value = CStr(x(i)) Then
menu.Enabled = True
Else
menu.Enabled = False
End If
Next i
End If
Next

But problem is that Menu1.Items consider only MenuItem1 and MenuItem2, and MenuSubItems are not in this collection.
Which kind of collection has both MenuItems and MenuSubItems?
 
You can just create a function that check if the MenuItem has any children and if it does call it recursivly.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top