Trying to get a drop down to display during the edit of a foreign key column. The examples all provided appear overly complex and I am unable to get my code functioning. Furthermore, the ASPX and Razor examples do not match their HTML counterparts. The examples also use ViewData and another uses a "Template". I am unable to unwind all the different parts of the examples since they are not self-contained.
http://demos.kendoui.com/web/grid/foreignkeycolumn.html
My Code Simplified:
In non-edit mode, the EquipmentTypeName resolves correctly, but upon edit, the EquipmentTypeId is displayed (as an int). I need to bind a dropdown in edit mode to a model action.
http://demos.kendoui.com/web/grid/foreignkeycolumn.html
My Code Simplified:
@(Html.Kendo().Grid<
Business.EquipmentModel
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(e => e.EquipmentId);
columns.Bound(e => e.Make);
columns.Bound(e => e.Model);
columns.Bound(e => e.EquipmentTypeId);
columns.ForeignKey(e => e.EquipmentTypeId, (System.Collections.IEnumerable)Business.EquipmentTypeModel.All(), "EquipmentTypeId", "EquipmentTypeName");
columns.Bound(e => e.FacilityId);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(e => e.EquipmentId))
.Read(read => read.Action("Equipment_Read", "Facilities"))
.Create(update => update.Action("Equipment_Create", "Facilities"))
.Update(update => update.Action("Equipment_Update", "Facilities"))
.Destroy(update => update.Action("Equipment_Destroy", "Facilities"))
)
)