treeview Passing Additional Data Server Call

2 posts, 0 answers
  1. Angela
    Angela avatar
    1 posts
    Member since:
    Aug 2018

    Posted 25 Apr 2019 Link to this post

    Hi I am struggling to figure this out...I am trying to pass additional data on the call.  The id that treeview comes up with is always there and correct.  But my roleid is always null.  And the RoleId is valid number.  Running out of places to look so I figured I post...


                                    .DataSource(dataSource => dataSource
                                        .Read(read => read.Action("permissions", "roles", new { RoleId = @Model.RoleId}))



            public JsonResult Permissions(int? id, int? RoleId)
                var roleFormMgr = new RoleFormMgr(StateMgmt);
                var roleEntity = roleFormMgr.GetRole(RoleId.GetValueOrDefault());
                var roleFormVM = roleFormMgr.PopulateView(Mapper.Map<RoleForm>(roleEntity));
                var permissions = roleFormVM.RolePermissionList.Where(p => id.HasValue ? p.parentId == id : (id == null && p.parentId == 0)).ToList();
                return Json(permissions, JsonRequestBehavior.AllowGet);

  2. Dimitar
    Dimitar avatar
    760 posts

    Posted 29 Apr 2019 Link to this post

    Hi Angela,

    The Data() method could be used to pass additional data to the controller end-point as follows:
      .DataSource(dataSource => dataSource
        .Read(read => read
          .Action("Read_TreeViewData", "Home").Data("onAdditionalData")
       var role = @Html.Raw(Json.Encode(Model.RoleId));
        function onAdditionalData(e) {
            return {
                roleId: role

    Then, the data can be successfully received in the controller end-point:
    public ActionResult Read_TreeViewData(int? id, int roleId)

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top