Am I missing something here? menu is not displaying any data, even though adding a breakpoint on the query and look at the results it is returning 3 records.
adminMenu user control:
adminMenu code behind:
If I use an <items> tag in the markup the menu displays it no probs. the ByHierarchy extension method is a way to retrieve hierarchal linq data, stolen from here: http://weblogs.asp.net/okloeten/archive/2006/07/09/Hierarchical-Linq-Queries.aspx
adminMenu user control:
| <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="adminMenu.ascx.cs" Inherits="Waivenet.adminMenu" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <telerik:RadMenu ID="RadMenu1" runat="server"> |
| </telerik:RadMenu> |
adminMenu code behind:
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using Waivenet.Linq; | |
| using System.Web; | |
| using System.Web.UI; | |
| using System.Web.UI.WebControls; | |
| namespace Waivenet | |
| { | |
| public partial class adminMenu : System.Web.UI.UserControl | |
| { | |
| protected void Page_Load(object sender, EventArgs e) | |
| { | |
| DataClassesDataContext dbcontext = new DataClassesDataContext(); | |
| RadMenu1.Skin = SessionWrapper.skin; | |
| var sdf = from s in dbcontext.siteMaps.ByHierarchy<siteMap>(t => t.sitemapID == SessionWrapper.siteMapIDCurrent, (parent, child) => (parent.sitemapID == child.parentID)) select new { s.Item.parentID, s.Item.sitemapID, s.Item.name, s.Item.pagePath }; | |
| RadMenu1.DataFieldID = "sitemapID"; | |
| RadMenu1.DataFieldParentID = "parentID"; | |
| RadMenu1.DataTextField = "name"; | |
| RadMenu1.DataValueField = "sitemapID"; | |
| RadMenu1.DataNavigateUrlField = "pagePath"; | |
| RadMenu1.DataSource = sdf; | |
| RadMenu1.DataBind(); | |
| } | |
| } | |
| } |
If I use an <items> tag in the markup the menu displays it no probs. the ByHierarchy extension method is a way to retrieve hierarchal linq data, stolen from here: http://weblogs.asp.net/okloeten/archive/2006/07/09/Hierarchical-Linq-Queries.aspx