Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:49:52+00:00 2026-06-16T05:49:52+00:00

I am using MVC4 and C#. I have a KendoUI Treeview and I’d like

  • 0

I am using MVC4 and C#.
I have a KendoUI Treeview and I’d like to populate it with data from RavenDB.

In the demo they use this:

public JsonResult Employees(int? id)
    {
        var dataContext = new NorthwindDataContext();

        var employees = from e in dataContext.Employees
                        where (id.HasValue ? e.ReportsTo == id : e.ReportsTo == null)
                        select new {
                            id = e.EmployeeID,
                            Name = e.FirstName + " " + e.LastName,
                            hasChildren = e.Employees.Any()
                        };

        return Json(employees, JsonRequestBehavior.AllowGet);
}

Notice the argument “id” – it’s an int. In RavenDb document ID’s are strings eg. myDco/231…

Imagine this is a standard document:

{
  "CreationDate": "12/12/2012 8:07:59 PM",
  "Name": "jkljklk",
  "Type": "kljkljkljkljkl",
  "Description": "ljkljklj",
  "CreatedByUser": "ljklklkljklj",
  "Deleted": false,
  "Status": "NEW",
  "Parent": "product/546"
}

How would I populate the treeview?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:49:55+00:00Added an answer on June 16, 2026 at 5:49 am

    I figured this out.

    I changed my RavenDB Document to include a list of all its children:

    {
      "CreationDate": "12/12/2012 9:33:34 PM",
      "Name": "hohoho",
      "Type": "hohohoh",
      "Description": "hohohoh",
      "CreatedByUser": "hohohoh",
      "Deleted": false,
      "Status": "NEW",
      "Parent": "ohohohoh",
      "Children": [
      "item/1",
      "item/2",
      "item/3"
      ]
    }
    

    I then returned a list of my items to the View via the controller and then iterated through them, appending all the children to their correct parent nodes:

    @(Html.Kendo().TreeView().Name("TreeView").DragAndDrop(true)
    .Items(treeview =>
               {
                   foreach (var myItem in Model)
                   {
                       var myItemName = myItem.Name;
                       var children = myItem.Children;
                       treeview.Add().Text(myItemName ).Expanded(false).Items(branch =>
                                                                                 {
                                                                                      if (children != null)
                                                                                         {
                                                                                             foreach (var child in children)
                                                                                             {
                                                                                                 branch.Add().Text(child);
                                                                                             }
                                                                                         }
                                                                                 });
                   }
               }
       ))
    

    Anyway, thanks for the responses 🙂

    Hope this helps someone else one day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC4 I have created a DelegatingHandler in a WebAPI project. I use
I am using KendoUI on MVC4 . I have a DropDownList bound to a
I have code like below in ASP.Net MVC4. and I am using Razor engine.
I'm using SignalR in my mvc4 web application. I have a class inheriting from
I'm using asp.net mvc4, simplemembership and EF. actually i have this code to search
I've created a method using the new WebAPI features in MVC4 and have it
I have been writing an application using ASP.Net MVC4, where the majority of the
I hope this is an easy one. Using MVC4 with Entity Framework 4.1. I'am
I am using mvc4 and have a telerik control grid with editing mode enabled.
I have a ASP.NET MVC4 project with HTML5 semantic markup enabled. When using @Html.EditorFor(m

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.