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

menu not displaying any data

3 Answers 61 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Growls
Top achievements
Rank 1
Growls asked on 08 Jan 2010, 03:56 AM
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

3 Answers, 1 is accepted

Sort by
0
Growls
Top achievements
Rank 1
answered on 08 Jan 2010, 05:37 AM
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


0
Accepted
Yana
Telerik team
answered on 08 Jan 2010, 03:47 PM
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.
0
Growls
Top achievements
Rank 1
answered on 10 Jan 2010, 09:50 PM
that fixed it thanks! Sorry for my moronism.
Tags
Menu
Asked by
Growls
Top achievements
Rank 1
Answers by
Growls
Top achievements
Rank 1
Yana
Telerik team
Share this question
or