This is a migrated thread and some comments may be shown as answers.

How to find root of RadMenu

3 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Behnam
Top achievements
Rank 1
Behnam asked on 09 Mar 2012, 11:53 AM
hi, I'm using RadMenu in my webapplication which shows menus and sub menus
There are Two Main Root that each has some sub menues
1. Articles
2. Videos
each item has sub menu
like this
Article > Programming
Article > Web
Article > Programming > C
Article > Programming > C#
Article > Web > ASP.NET
Article > Web > PHP

Video> Programming
Video> We
Video> Programming > C
Video> Programming > C#
Video> Web > ASP.NET
Video> Web > PHP

and so on
how can i find which of the selected items belongs to Article and Which of them belong to Video?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Mar 2012, 01:27 PM
Hello,

Take a look into the following code.
C#:
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
 {
  if (e.Item.Owner is RadMenuItem)
   {
    if (RadMenu1.SelectedItem.Level == 1)
     {
      RadMenuItem parentItem = (RadMenuItem)e.Item.Owner;
      string submenuitem1= parentItem.Text;
     }
    if (RadMenu1.SelectedItem.Level == 2)
     {
      RadMenuItem parentItem = ((RadMenuItem)e.Item.Owner.Owner);
      string submenuitem2 = parentItem.Text;
     }
   }
 }

Thanks,
Princy.
0
Behnam
Top achievements
Rank 1
answered on 09 Mar 2012, 02:59 PM
what if my menu level grows to 5,6 and so on?
0
Behnam
Top achievements
Rank 1
answered on 10 Mar 2012, 01:57 PM
RadMenu1.SelectedItem.level returns a null value!!!!!!!
Tags
General Discussions
Asked by
Behnam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Behnam
Top achievements
Rank 1
Share this question
or