Hello,
I am working on creating a dynamic Grid In MVC with adding rows with cascaded dropdownlists.
Please if you have a sample on cascaded dropdownlists in Grid/edit and add,
i am using below code in Generating dropdownlist but couldn't tell how to filter Dropdownlist based on DropDownListCategory :
@{
var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList() { DataSource = ViewBag.Items, Query = "new ej.data.Query()", AllowFiltering = true, Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "Id", Text = "ItemDescription" } };
var DropDownListCategory = new Syncfusion.EJ2.DropDowns.DropDownList() { DataSource = ViewBag.Categories, Query = "new ej.data.Query()", AllowFiltering = true, Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "id", Text = "ItemCategory1" } };
}
@Html.EJS().Grid("InlineEditing").DataSource((IEnumerable<object>)ViewBag.Orders).Columns(col =>
{
col.Field("Id").HeaderText("OrderID").Width("140").ValidationRules(new {number = true }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CategoryID").HeaderText("CategoryID").Width("150").ValidationRules(new { required = true, minLength = 3 }).EditType("dropdownedit").Edit(new { @params = DropDownListCategory }).Add();
col.Field("Itemid").HeaderText("Itemid").Width("150").ValidationRules(new { required = true, minLength = 3 }).EditType("dropdownedit").Edit(new { @params = DropDownList }).Add();
col.Field("Qty").HeaderText("Qty").Width("140").EditType("numericedit").ValidationRules(new { required = true }).Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("AgencyLotNumber").HeaderText("LotNumber").Width("140").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ProducerLotNumber").HeaderText("ProducerLotNumber").Width("140").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
}).ActionBegin("actionBegin").AllowPaging().PageSettings(page => page.PageCount(2)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
Thank you,
Best Regards,