Showing nodes with parent id didn't exists in the list

2 posts, 0 answers
  1. Firoz Ansari
    Firoz Ansari avatar
    16 posts
    Member since:
    Apr 2010

    Posted 04 Mar 2011 Link to this post

    I am working on a page which shows hirarchical records through RadTreeList control. Everything looks fine except records with parent id which didnt exists in list. Not sure if this is a limitation of RadTreeList control or if there is any flag which allow to display these kind of records.

    I have many records in the table with parent id which didn't exists in the table but we still want to show those records in TreeList control.

    To explain the issue, there is test page. As you can see in result, first record ("Appetizers") is not rendering on the page as parent id "Y", didn't exists in list.

    Thank you in advance for your help.


    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
    <telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"
        ParentDataKeyNames="ParentID" DataKeyNames="ID" AllowPaging="true" PageSize="5"
        AutoGenerateColumns="false" AllowSorting="true">
            <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" HeaderText="Category ID" />
            <telerik:TreeListTemplateColumn DataField="ProductName" UniqueName="ProductName" HeaderText="Product">
                    <%# Eval("ProductName")%>
                <HeaderStyle Width="300px" />
            <telerik:TreeListBoundColumn DataField="ParentID" UniqueName="ParentID" HeaderText="Parent Category ID" />

    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
        protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
            RadTreeList1.DataSource = MyData.GetData();
    public class MyData
        public static List<MyItem> GetData()
            List<MyItem> list = new List<MyItem>();
            list.Add(new MyItem("A", "Appetizers", "Y"));
            list.Add(new MyItem("B", "Beverages", ""));
            list.Add(new MyItem("C", "Cheese", ""));
            return list;
    public class MyItem
        public string ID { get; set; }
        public string ProductName { get; set; }
        public string ParentID { get; set; }
        public MyItem(string id, string productName, string parentID)
            ID = id;
            ProductName = productName;
            ParentID = parentID;
  2. Veli
    Veli avatar
    2002 posts

    Posted 07 Mar 2011 Link to this post

    Hi Firoz,

    RadTreeList does not currently support this scenario. Only items contaning default values, null and DbNull for their parent key names qualify as root items. We are planning to extend RadTreeList to support specification of custom values for root items in future versions, even though we cannot give any particular schedules for that.

    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft R3 2016 release webinar banner
Back to Top