Because a grid i try to implement has records with many (large) dropdownboxes, i have set them to autobind false. Now when a record is set to editmode, the dropdownbox is empty, when clicked it is populated and the appropiate item is selected. Because an empty dropdownlist is confusing the user, i'm looking for a solution where the value is displayed.
View:
@(Html.Kendo().Grid<
Indato.Data.EF.Models.Oplovk
>()
.Name("grid")
.Columns(columns =>
{
columns.ForeignKey(c => c.idCategory, (System.Collections.IEnumerable)ViewData["Categories"], "idCategory", "Name").Title("Category").EditorTemplateName("Category");
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.id);
})
)
.ClientDetailTemplateId("template")
Editortemplate:
@model object
@(
Html.Kendo().DropDownListFor(m => m)
.AutoBind(false)
.DataSource(ds =>
{
ds.Read("Catgories", "Category", new { Area = "Tabellen" });
})
.DataTextField("Name")
.DataValueField("idCategory")
)