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

[Solved] TreeView Checkbox is not displaying for Nodes Loaded On Demand

1 Answer 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pradeep N
Top achievements
Rank 1
Pradeep N asked on 20 Aug 2010, 02:32 PM

Hi guys,
In TreeView i am adding a single node at pageload. Loading their child on LoadOnDemand as follows. I gave ShowCheckBox(true). The check box is displaying only in the root node not on the nodes loaded on demand. Please let me know what am i doing wrong.

<%= Html.Telerik().TreeView()
        .Name("AjaxTreeView")
        .ShowCheckBox(true)
           .Items(item => item.Add()
                           .Text("All Categories")
                           .LoadOnDemand(true))

        .DataBinding(dataBinding => dataBinding
                .Ajax().Select("_AjaxLoading", "TreeView")
        )
%>


[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult _AjaxLoading(TreeViewItemModel node)
        {
            NorthwindDataContext northwind = new NorthwindDataContext();
 
            int? parentId = !string.IsNullOrEmpty(node.Value) ? (int?) Convert.ToInt32(node.Value)  : null;
             
            IEnumerable nodes = from item in northwind.Employees
                                where item.ReportsTo == parentId || (parentId == null && item.ReportsTo == null)
                                select new TreeViewItemModel
                                {
                                    Text = item.FirstName + " " + item.LastName,
                                    Value = item.EmployeeID.ToString(),
                                    LoadOnDemand = item.Employees.Count > 0,
                                    Enabled = true
                                };
 
            return new JsonResult { Data = nodes };
        }


Regards,
Pradeep.

1 Answer, 1 is accepted

Sort by
0
Pradeep N
Top achievements
Rank 1
answered on 25 Aug 2010, 09:45 AM
Hi,
I have upgraded my app to Q2 2010 Beta 2010.2.713.235 and the above said issue had been fixed.
However there is a small designer issue in Web2.0 Theme for load on demand. There is an extra stem at parent node of treeview.
I have attached the screen shot.

Thanks,
Pradeep.

Tags
General Discussions
Asked by
Pradeep N
Top achievements
Rank 1
Answers by
Pradeep N
Top achievements
Rank 1
Share this question
or