The ASP.NET MVC TreeView is a graphical user interface control that to represents hierarchical data in a tree structure. It provides great performance with its advanced features like load on demand, checkbox support, multiple selection, tree navigation, drag and drop, tree node editing, and template support.
Bind data to the TreeView control from any valid data source, such as XML, JSON, and JSONP. The tree data can be local or remote data and fetched using different kinds of adaptors like OData, OData V4, URL, JSON, and Web API.
The ASP.NET MVC TreeView control has a load-on-demand option that allows you to load huge amounts of data dynamically, which improves the control’s performance.
Also, child nodes in the control can be loaded from any web services or inserted dynamically.
Display nodes with labels and icons to present the content in a more readable format. This is helpful in making a typical directory tree and file system.
The ASP.NET MVC TreeView control provides built-in support for checkboxes, allowing users to select more than one item.
The tree view checkbox has a tri-state mode also, which is applicable only for parent nodes. In this mode, the parent node will go into the indeterminate state when the child nodes are partially checked.
Tree nodes can be dragged and dropped from one parent node to another within the same level or at different levels.
Extending the drop behavior allows users to drop tree nodes from one tree view to another.
Drop tree nodes to any external container or component by extending the tree view node drop action.
The ASP.NET MVC TreeView control allows users to select multiple nodes. When the drag-and-drop feature is enabled, all the selected nodes can be dragged at the same time.
Edit the tree nodes’ label text on the client side by double-clicking it. When editing tree view nodes, the tree view data source will also be updated with the modified data.
Render the tree view nodes in the ascending or descending order based on the label text for improved readability.
The ASP.NET MVC TreeView control can be customized through its node template support, which allows defining a custom structure for tree nodes. You can use node templates specifically for parent nodes, child nodes, or both, and include images and any custom element structure.
Easily customize the expand and collapse icons based on the requirement of your application.
Supports right-to-left (RTL) direction for users working with right-to-left languages like Hebrew, Arabic, or Persian.
Easily get started with the ASP.NET MVC TreeView using a few simple lines of C# code as demonstrated below. Also explore our ASP.NET MVC TreeView Example that shows you how to render and configure the treeview.
@using Syncfusion.EJ2.Navigations
@Html.EJS().TreeView("listdata").Fields(field=>
field.Id("id").ParentID("pid").Selected("selected").
Expanded("expanded").Text("name").HasChildren("hasChild")
.DataSource(ViewBag.dataSource)).Render()
public partial class TreeViewController : Controller
{
TreeViewFieldsSettings fields = new TreeViewFieldsSettings();
public ActionResult DefaultFunctionalities()
{
List<object> listdata = new List<object>();
listdata.Add(new
{
id = 1,
name = "Australia",
hasChild = true,
expanded = true
});
listdata.Add(new
{
id = 2,
pid = 1,
name = "New South Wales",
});
listdata.Add(new
{
id = 3,
pid = 1,
name = "Victoria"
});
listdata.Add(new
{
id = 4,
pid = 1,
name = "South Australia"
});
listdata.Add(new
{
id = 6,
pid = 1,
name = "Western Australia",
});
listdata.Add(new
{
id = 7,
name = "Brazil",
hasChild = true
});
listdata.Add(new
{
id = 8,
pid = 7,
name = "Paraná"
});
listdata.Add(new
{
id = 9,
pid = 7,
name = "Ceará"
});
listdata.Add(new
{
id = 10,
pid = 7,
name = "Acre"
});
listdata.Add(new
{
id = 11,
name = "China",
hasChild = true
});
listdata.Add(new
{
id = 12,
pid = 11,
name = "Guangzhou"
});
listdata.Add(new
{
id = 13,
pid = 11,
name = "Shanghai"
});
listdata.Add(new
{
id = 14,
pid = 11,
name = "Beijing"
});
listdata.Add(new
{
id = 15,
pid = 11,
name = "Shantou"
});
listdata.Add(new
{
id = 16,
name = "France",
hasChild = true
});
listdata.Add(new
{
id = 17,
pid = 16,
name = "Pays de la Loire"
});
listdata.Add(new
{
id = 18,
pid = 16,
name = "Aquitaine"
});
listdata.Add(new
{
id = 19,
pid = 16,
name = "Brittany"
});
listdata.Add(new
{
id = 20,
pid = 16,
name = "Lorraine"
});
listdata.Add(new
{
id = 21,
name = "India",
hasChild = true
});
listdata.Add(new
{
id = 22,
pid = 21,
name = "Assam"
});
listdata.Add(new
{
id = 23,
pid = 21,
name = "Bihar"
});
listdata.Add(new
{
id = 24,
pid = 21,
name = "Tamil Nadu"
});
ViewBag.dataSource = listdata;
return View();
}
}
The TreeView component is also available in Blazor, React, Angular, JavaScript and Vue frameworks. Check out the different TreeView platforms from the links below,
The ASP.NET MVC TreeView control for ASP.NET MVC has a rich set of developer-friendly APIs to control all UI elements and behaviors, allowing you to provide the best experience to your end users.
You can find our ASP.NET MVC Tree View demo here.
No, this is a commercial product and requires a paid license. However, a free community license is also available for companies and individuals whose organizations have less than $1 million USD in annual gross revenue and five or fewer developers.
A good place to start would be our comprehensive getting started documentation.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.