<div class="e-float-input e-control-wrapper">
<ejs-dropdowntree id="ParentSelectID" placeholder="@ResourcesWeb.ProjectManagementResource.ParentDivValue" changeOnBlur="false" cssClass="e-outline">
<e-dropdowntree-fields dataSource="ViewBag.Divisions" hasChildren="IsParent" text="Value" value="ID" parentValue="ParentID"></e-dropdowntree-fields>
</ejs-dropdowntree>
</div>
</div>
<ejs-scripts></ejs-scripts>
<style>
#Dialog {
width: 20%;
margin: auto;
/*margin-top: 20px;*/
min-height: 40%;
}
</style>
@{
var defaultAnimation = new Syncfusion.EJ2.Popups.DialogAnimationSettings { Effect = Syncfusion.EJ2.Popups.DialogEffect.Fade, Duration = 150, Delay = 0 };
}
<div id="Details" class="row ">
<ejs-dialog id="Dialog" animationSettings="defaultAnimation" showCloseIcon="true" isModal="true" target="#Details" visible="false" created="Created" header="@ResourcesWeb.ProjectManagementResource.DivisionValue" beforeClose="Close">
<e-content-template>
<div>
<div class="e-content">
<div id="DialogContent">
</div>
</div>
</div>
</e-content-template>
</ejs-dialog>
<button type="button" onclick="GetDialog()"> Click</button>
</div>
@*New Division Dialog*@
<script>
var val;
function Created() {
val = this;
}
function Close() {
document.getElementById('DialogContent').innerHTML = "";
}
function GetDialog() {
ej.popups.createSpinner({ target: document.getElementById('DialogContent') });
ej.popups.showSpinner(document.getElementById('DialogContent'));
var ajax = new ej.base.Ajax("@Url.Action("AddPartial", "SRMTest")", "GET", true);
ajax.send();
ajax.onSuccess = function (result) {
if (document.getElementById('DialogContent')) {
ej.popups.hideSpinner(document.getElementById('DialogContent'));
document.getElementById('DialogContent').innerHTML = result;
eval(document.getElementById('DialogContent').querySelector('script').innerHTML);
}
};
ajax.onFailure = function (result) {
if (document.getElementById('DialogContent')) {
ej.popups.hideSpinner(document.getElementById('DialogContent'));
document.getElementById('DialogContent').innerHTML = failed;
}
};
val.show();
}
</script>
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace AssembleWeb.Controllers.Supplier
{
public class SRMTestController : Controller
{
public IActionResult Index()
{
try
{
return View("Views/Supplier/SRMTesting.cshtml");
}
catch (Exception ex)
{
return BadRequest($"Error getting from api: {ex.Message},{ex.InnerException}");
}
}
public IActionResult AddPartial()
{
ViewBag.Divisions = new List<TestModel>() {
new TestModel { ID = 1, Value = "1-Value1", IsParent = true},
new TestModel { ID = 2, Value = "1-Value2", IsParent = false, ParentID = 1},
new TestModel { ID = 3, Value = "2-Value1", IsParent = true},
new TestModel { ID = 4, Value = "2-Value2", IsParent = false, ParentID = 3}
};
return PartialView("Views/Supplier/PartialTest.cshtml");
}
}
public class TestModel
{
public int ID { get; set; }
public string Value { get; set; }
public bool IsParent { get; set; }
public int? ParentID { get; set; }
}
}