Currently I have a grid that I am trying to have a drop down list appear in one of the columns while in Edit mode using the ForeignKey column.
The grid loads with all the correct data, and even shows the TypeName name while in Read mode. However, when switching to Edit mode the column shows the TypeID in a text box, not a drop down list. The code to populate the ViewBag is below
All the data appears to end up on the page - when inspecting the editable element the list of options appears in a jQuery script, however, they do not populate a drop down while editing.
The code matches the Kendo MVC demo as much as possible, so am I missing something? Are there certain constraints that need to be met?
@(Html.Kendo().Grid<Inspection>()
.Name("grid")
.DataSource(dataSource => dataSource.Ajax()
.Model(model =>
{
model.Id(p => p.ID);
model.Field(p => p.Date);
model.Field(p => p.TypeID);
})
.Read(read => read.Action("grid_Read", "Grid", new { ID = Model.ID }))
.Update(update => update.Action("grid_Update", "Grid", new { ID = Model.ID }))
.PageSize(10))
.Columns(columns =>
{
columns.Bound(c => c.RequestedDate).Format("{0:d}").EditorTemplateName("_DateTime").Width(200);
columns.ForeignKey(c => c.TypeID, (System.Collections.IEnumerable)ViewBag.Types, "TypeID", "TypeName").Title("Test Types");
columns.Command(command => { command.Edit(); });
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable(pageable => pageable.Messages(messages => messages.Empty("Nothing Here")))
.Sortable(sortable => sortable.AllowUnsort(false))
)
The grid loads with all the correct data, and even shows the TypeName name while in Read mode. However, when switching to Edit mode the column shows the TypeID in a text box, not a drop down list. The code to populate the ViewBag is below
ViewBag.Types = _service.Repository.InspectionTypes;
All the data appears to end up on the page - when inspecting the editable element the list of options appears in a jQuery script, however, they do not populate a drop down while editing.
The code matches the Kendo MVC demo as much as possible, so am I missing something? Are there certain constraints that need to be met?