Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144805 | May 23,2019 02:02 PM UTC | May 28,2019 08:51 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Treeview |
@Imports Syncfusion.EJ2
<!DOCTYPE html>
<html>
<head>
...
<!-- Syncfusion Essential JS 2 Styles -->
<link rel="stylesheet" rel='nofollow' href="https://cdn.syncfusion.com/ej2/material.css" />
<!-- Syncfusion Essential JS 2 Scripts -->
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script>
</head>
<body>
...
@Html.EJS().ScriptManager()
</body>
</html> |
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
...
<add namespace="VBSample" />
<add namespace="Syncfusion.EJ2" />
</namespaces>
</pages> |
@Imports Syncfusion.EJ2
@Imports Syncfusion.EJ2.Navigations
<div id="ControlRegion">
@Html.EJS().TreeView("listdata").Fields(Function(field) field.Id("Id").DataSource(ViewBag.data).ParentID("ParentId").Text("Text").HasChildren("hasChild")).Render()
</div> |
Dim treedata As New List(Of Data)()
treedata.Add(New Data() With {
.Id = "1",
.Text = "Australia",
.hasChild = True
})
treedata.Add(New Data() With {
.Id = "2",
.Text = "Victoria",
.ParentId = "1"
})
treedata.Add(New Data() With {
.Id = "3",
.Text = "Western Australia",
.ParentId = "1"
})
treedata.Add(New Data() With {
.Id = "5",
.Text = "Brazil",
.hasChild = True
})
treedata.Add(New Data() With {
.Id = "13",
.Text = "China",
.hasChild = True
})
ViewBag.data = treedata
Return View() |
Dim data As Object = New Syncfusion.EJ2.DataManager With {
.Url = "https://services.odata.org/V4/Northwind/Northwind.svc",
.Adaptor = "ODataV4Adaptor",
.CrossDomain = True
}
parentData.Query = "new ej.data.Query().from('Employees').select('EmployeeID,FirstName,Title').take(5)"
parentData.Id = "EmployeeID"
parentData.Text = "FirstName"
parentData.HasChildren = "EmployeeID"
parentData.Child = childData
parentData.DataSource = data
childData.Query = "new ej.data.Query().from('Orders').select('OrderID,EmployeeID,ShipName').take(5)"
childData.Id = "OrderID"
childData.Text = "ShipName"
childData.ParentId = "EmployeeID"
childData.DataSource = data
ViewBag.remoteFields = parentData
Return View() |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.