menu not displaying any data

4 posts, 1 answers
  1. Growls
    Growls avatar
    20 posts
    Member since:
    Apr 2009

    Posted 07 Jan 2010 Link to this post

    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:
    <%@ 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

  2. Growls
    Growls avatar
    20 posts
    Member since:
    Apr 2009

    Posted 07 Jan 2010 Link to this post

    If I remove the hierarchal data fields:
     RadMenu1.DataFieldID = "sitemapID";            
     RadMenu1.DataFieldParentID = "parentID";
    then the three records display one after the other without any hierarchal relationship.
    as soon as I add them the control doesnt render.
    Is this a new bug introduced? (I downloaded the latest version of rad controls and am using it, RadControls_for_ASP.NET_AJAX_2009_3_1208_dev


  3. Answer
    Yana
    Admin
    Yana avatar
    4850 posts

    Posted 08 Jan 2010 Link to this post

    Hi Growls,

    Please check whether you've set null to parentID of the root items.

    Best regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. Growls
    Growls avatar
    20 posts
    Member since:
    Apr 2009

    Posted 10 Jan 2010 Link to this post

    that fixed it thanks! Sorry for my moronism.
Back to Top