Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143893 | Apr 9,2019 03:13 PM UTC | Apr 10,2019 01:25 PM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: TreeView |
// View part
<form id="frmUsuario" class="form-horizontal" asp-controller="MyCal" asp-action="GetValues" autocomplete="off" data-ajax="true" data-ajax-method="POST"
data-ajax-success="fnSuccess(data)" data-ajax-failure="fnFailure()">
<ejs-treeview id="treedata" name="treedata" showCheckBox="true" loadOnDemand="false">
<e-treeview-fields dataSource="Model.DataSource" id="Id" parentId="PId" text="Name" hasChildren="HasChild" expanded="expanded"></e-treeview-fields>
</ejs-treeview>
<br />
<label for="art"> Enter the node id to be checked: </label>
<input id="art" class="e-input" type="text" name="art" />
<br />
<input type="submit" id="button" value="Submit" />
</form> |
// Controller part
[HttpPost]
public IActionResult GetValues()
{
string value = HttpContext.Request.Form["art"];
ViewBag.Result = value;
return Json(value);
} |
// After ajax succeeded
function fnSuccess(data) {
console.log(data);
data = data.split(",")
var treeView = document.getElementById('treedata').ej2_instances[0];
treeView.checkAll(data);
} |
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.