Does anyone have an example of how to populate a dropdown column in the
detail grid of a master/detail using UrlAdaptor?
My column definition looks like this:
{
new Syncfusion.EJ2.Grids.GridColumn() {Field="ReferencedTableName", HeaderText="Referenced Table Name", IsPrimaryKey=true, Visible=false, AutoFit=true, CustomAttributes=new { @@class="e-attr" }},
new Syncfusion.EJ2.Grids.GridColumn() {Field="TableName", HeaderText="Table Name", IsPrimaryKey=true, AutoFit=true, ForeignKeyField="TableName", ForeignKeyValue="TableNameDesc", DataSource="@ViewBag.Tables", EditType="dropdownedit", CustomAttributes=new { @@class="e-attr" }},
new Syncfusion.EJ2.Grids.GridColumn() {Field="ColumnName", HeaderText="Column Name", IsPrimaryKey=true, AutoFit=true, CustomAttributes=new { @@class="e-attr" }}
}
One problem is that the code in the controller that populates Viewbag.Tables is not being run for the detail grid (see below). What complicates things a little further is that I have dropdown column named ReferenceTableName in the master which is being populated with the same data properly, and I am populating Viewbag.Tables exactly the same way in the master controller. I can populate a different Viewbag variable if needed.
public ActionResult Index()
{
var Tables = (from p in _context.Tables orderby p.TableName
select new { p.TableName,
TableNameDesc = p.TableName }).ToList();
ViewBag.Tables = Tables;
return View("Views/Basic/DropdownsDetail.cshtml",Navigation.GetTableList(_context));
}
}