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

Menu filtering using xpath

1 Answer 56 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 02 Nov 2012, 02:23 PM
Hi! Im using radmenu like this:

<Menu>
  <Item text="lvl1" Role="A">
    <Item text="lvl2" Role="A">
      <Item text="lvl3" Role="A" />
      <Item text="lvl3" Role="B" />
    </Item>
    <Item text="lvl2" Role="B" />
  </Item>
  <Item text="lvl1" Role="B">
  </Item>
</Menu>

<asp:XmlDataSource DataFile="LikeAbove" ID="xmlDataSource" XPath="//Item[@Role='A']" runat="server />
<telerik:RadMenu DataSourceID="xmlDataSource" runat="Server">
  <DataBindings>
    <telerik:RadMenuItemBinding Depth="0" TextField="Text" />
    <telerik:RadMenuItemBinding Depth="1" TextField="Text" />
  </DataBindings>
</telerik:RadMenu>

What Im trying to do is to get all menu items with the role "A", filtering on all levels. I works on a single level using this /Item[@Role='A']but when using this approach on a multi level //Item[@Role='A'] (two slash in the beginning) it "flats out", meaning all menu nodes are being visible on the first level AND also still remains unfiltered where they used to be in the tree.

1 Answer, 1 is accepted

Sort by
0
Max
Top achievements
Rank 1
answered on 02 Nov 2012, 04:21 PM
Or if someone has another approach how to make menu items hidden depending on their role, please share! Still I'd like to have an xml file as the datasource.
Tags
Menu
Asked by
Max
Top achievements
Rank 1
Answers by
Max
Top achievements
Rank 1
Share this question
or