This is a migrated thread and some comments may be shown as answers.
Telerik MVC Tree View Accessbility Binding Example
0 Answers 36 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
Narayana asked on 24 Jan 2012, 02:56 AM
I want to implement the telerik MVC Tree view using the Accessiblity Binding example.In the Telerik Demo Examples.

I need the code snippets for Controller,View, and Respective Models required for Employee table data in NorthWind Database.

My Request is to implement a  n -level tree view with  self referencing heirarchy using the same heirarchy format of Employee table.

I referred the code mentioned in the example.But it is giving some errors.

I am using the LinQ to SQL


<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Employee>>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


    <%= Html.Telerik().TreeView()
        .BindTo(Model, mappings =>
            mappings.For<Employee>(binding => binding
                    .ItemDataBound((item, employee) =>
                        item.Text = employee.FirstName + " " + employee.LastName;
                        item.Url = Url.Action("Accessibility", "Home", new { employeeName = employee.FirstName + " " + employee.LastName });
                        //item.Expanded = true;
                    .Children(category => category.Employees));


 public ActionResult Accessibility(string employeename)
           TreeViewModel tvm = new TreeViewModel();
            return View(tvm.GetRootEmployees());


public class TreeViewModel

        public IEnumerable<Employee> GetRootEmployees()
            TestTelerikTreeDataContext ttdc = new TestTelerikTreeDataContext();

            return ttdc.Employees.Where(e => e.ReportsTo == null);



Error Page:

Asked by
Top achievements
Rank 1
Share this question