Hierarchical treeview binding issue

2 posts, 0 answers
  1. Dayana Maliyakal
    Dayana Maliyakal avatar
    27 posts
    Member since:
    Jan 2010

    Posted 14 Feb 2014 Link to this post

    Hi,

    I have a treeview as following:

    View

    <script type="text/javascript">
     
    function onDataBinding(e) {
    var StatusID = $("#rcbProject").data("tComboBox").value();
    $.ajax({
    url: "/ucProject1/test?StatusID="
    + StatusID,
    data: {},
    success: function (data) {
    var treeview = $("#rtvProject").data("tTreeView");
    treeview.bindTo(data);
    }
    });
    }
    </script>

    <%=Html.Telerik()
    .TreeView()
    .Name("rtvProject")
    .ExpandAll(true)
    .ClientEvents(events =>
    {
    events.OnDataBinding("onDataBinding");
    })
    %>


    controller

    public JsonResult test(int StatusID)
    {
     
     DataTable dt = new DataTable();
     dt = GetItems(0, StatusID);
     var result = (from DataRow dr in dt.AsEnumerable()
     select new
     {
     Value = dr["ProjectID"],
     Text = dr["ProjectDisplayName"]
     }).ToArray();
     
     return Json(result, JsonRequestBehavior.AllowGet);
    }


    It is working.But I really need a hierarchical treeview.I want to add ParentID also other than Value and Text. Based on ParentID tree should  display.How this possible?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 19 Feb 2014 Link to this post

    Hello Dayana,

    The Telerik MVC Extensions that you are using are no longer supported. Consider migrating to KendoUI Extensions for ASP.NET MVC:

    http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/migration/migrating-from-telerik-extensions-for-aspnet-mvc

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top