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

Children are not shown in TreeView

1 Answer 109 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gil
Top achievements
Rank 1
Gil asked on 28 Sep 2016, 08:14 AM

I made an update of the UI for ASP.NET MVC. Now, in the tree view only the root is shown and no longer any child.

The view is as follows:

                @(Html.Kendo().TreeView()
                              .Name("treeviewInner")
                              .BindTo((IEnumerable<TreeViewItemModel>)ViewBag.TreeViewContent) 
                )
Here is the code in the controller:

        private List<TreeViewItemModel> GetTreeViewData()
        {
            var items = new List<TreeViewItemModel>()
            {
                new TreeViewItemModel()
                {
                    Text = "0",
                    Items = new List<TreeViewItemModel>()
                    {
                        new TreeViewItemModel()
                        {
                            Text = "1"
                        }
                    }
                }
            };

            return items;
        }

        public ActionResult TreeViewContent(int wbsHeaderId)
        {
            ViewBag.TreeViewContent = GetTreeViewData();
            return PartialView();
        }

1 Answer, 1 is accepted

Sort by
0
Gil
Top achievements
Rank 1
answered on 28 Sep 2016, 09:43 AM
I found a solution by myself. The problem was that the path for the scripts has changed.
Tags
TreeView
Asked by
Gil
Top achievements
Rank 1
Answers by
Gil
Top achievements
Rank 1
Share this question
or