[Script]
function onNodeSelect(args) {
var value = args.value;
if (value == "Home" ||value=="File")
value="Index"
$.ajax({
url: "/Home/"+value,
type: "POST",
dataType: "json",
success: function (data) {
var theDiv = document.getElementById("rightsideTree");
theDiv.innerHTML = data;
}
});
} |
[CSHTML]
@Html.EJ().TreeView("tree").Items(items =>
{
items.Add().Text("File").Children(child =>
{
child.Add().Text("Home");
child.Add().Text("About");
child.Add().Text("Contact");
});
}).ClientSideEvents(evt => evt.NodeSelect("onNodeSelect")).EnablePersistence(true); |