I have 2 menus on a simple ASPX page. A top menu and a left menu. The left menu is a subset of data from the item I click on in the top menu.
I can get this to work properly, but ONLY on the first item I click on in the top menu. After that, the left menu only displays the initial data even though I rebind the menu with the new data set.
Here is my code:
I can see when I debug, that the left menu has no data in it and that the correct data is being databound to it, however I always end up with the inital data.
Any thoughts or suggestions would be GREATLY appreciated!
I can get this to work properly, but ONLY on the first item I click on in the top menu. After that, the left menu only displays the initial data even though I rebind the menu with the new data set.
Here is my code:
| ASPX: |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadMenu ID="mainRadMenu" runat="server" DataSourceID="mainRadMenuXDS" DataTextField="title" OnItemClick="mainRadMenu_ItemClick" PostBackUrl="~/Test.aspx"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </telerik:RadMenu> |
| <asp:XmlDataSource ID="mainRadMenuXDS" runat="server" DataFile="~/App_Data/XMLFile1.xml" XPath="/Items/Item" /> |
| <br /> |
| <br /> |
| <br /> |
| <br /> |
| <br /> |
| <telerik:RadMenu ID="leftRadMenu" runat="server" Flow="Vertical"> |
| <DefaultGroupSettings Flow="Horizontal" /> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </telerik:RadMenu> |
| <asp:XmlDataSource ID="leftRadMenuXDS" runat="server" XPath="/Items/Item" /> |
| CS: |
| protected void mainRadMenu_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e) |
| { |
| Session["MainMenu"] = e.Item.Text; |
| PopulateLeftMenu(); |
| } |
| protected void PopulateLeftMenu() |
| { |
| XmlDocument xmldoc = new XmlDocument(); |
| xmldoc.Load(Server.MapPath("~/App_Data/XMLFile1.xml")); |
| XmlNode mainMenuItem = xmldoc.SelectSingleNode(String.Format("//Items//Item[@title = '{0}']", Session["MainMenu"].ToString())); |
| XmlDocument leftMenuDocument = new XmlDocument(); |
| leftMenuDocument.LoadXml(String.Format("<Items>{0}</Items>", mainMenuItem.InnerXml.ToString())); |
| leftRadMenuXDS.Data = leftMenuDocument.InnerXml; |
| leftRadMenu.DataSourceID = leftRadMenuXDS.UniqueID; |
| leftRadMenu.DataTextField = "title"; |
| leftRadMenu.DataBind(); |
| } |
| XML: |
| <?xml version="1.0" encoding="utf-8" ?> |
| <Items> |
| <Item title="Menu 1" description=""> |
| <Item title="Menu 1A" description="" /> |
| <Item title="Menu 1B" description=""> |
| <Item title="Menu 1B1" description="" /> |
| <Item title="Menu 1B2" description="" /> |
| <Item title="Menu 1B3" description="" /> |
| <Item title="Menu 1B4" description="" /> |
| <Item title="Menu 1B5" description="" /> |
| </Item> |
| <Item title="Menu 1C" description="" /> |
| </Item> |
| <Item title="Menu 2" description=""> |
| <Item title="Menu 2A" description="" /> |
| <Item title="Menu 2B" description="" /> |
| </Item> |
| <Item title="Menu 3" description=""> |
| <Item title="Menu 3A" description="" /> |
| <Item title="Menu 3B" description="" /> |
| <Item title="Menu 3C" description="" /> |
| <Item title="Menu 3D" description="" /> |
| </Item> |
| <Item title="Menu 4" description=""> |
| <Item title="Menu 4A" description="" /> |
| <Item title="Menu 4B" description="" /> |
| <Item title="Menu 4C" description="" /> |
| <Item title="Menu 4D" description="" /> |
| </Item> |
| <Item title="Menu 5" description="" /> |
| </Items> |
I can see when I debug, that the left menu has no data in it and that the correct data is being databound to it, however I always end up with the inital data.
Any thoughts or suggestions would be GREATLY appreciated!