Ich arbeite mit KendoUI MVC in MVC3.Wie kann ich den Wert einer Dropdownliste in einem Grid in Kendo UI MVC festlegen und abrufen?
Ich habe es geschafft, ein Dropdown in einer Rasterspalte zu bekommen. Aber ich habe keine Ahnung, wie ich den ausgewählten Wert einstellen soll, und wenn ich ihn speichere, wird der ausgewählte Wert nicht gespeichert.
Das Gitter
@using Perseus.Areas.Communication.Models
@using Perseus.Common.BusinessEntities;
<div class="gridWrapper">
@(Html.Kendo().Grid<CommunicationModel>()
.Name("grid")
.Columns(colums =>
{
colums.Bound(o => o.communication_type_id)
.EditorTemplateName("_communicationDropDown")
.ClientTemplate("#: communication_type #")
.Title("Type")
.Width(180);
colums.Bound(o => o.sequence).Width(180);
colums.Bound(o => o.remarks);
colums.Command(command => command.Edit()).Width(50);
})
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.Editable(edit => edit.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model => model.Id(o => o.communication_id))
.Read(read => read.Action("AjaxBinding", "Communication", new { id = @ViewBag.addressId }))
.Update(update => update.Action("Update", "Communication"))
.Sort(sort => { sort.Add(o => o.sequence).Ascending(); })
.PageSize(20)
)
)
</div>
Die EditorTemplate „_communicationDropDown
@model Perseus.Areas.Communication.Models.CommunicationModel
@(Html.Kendo().DropDownListFor(c => c.communication_type_id)
.Name("DropDownListCommunication")
.DataTextField("description1")
.DataValueField("communication_type_id")
.BindTo(ViewBag.CommunicationTypes))
Haben Sie einen bekommen? y Lösung? Ich habe das gleiche Problem. Ich kann Text in Dropdown-Liste anzeigen, wie kann ich Wert festlegen. –
Scheint, das Problem ist gelöst, könnten Sie bitte klären, was das Feld "communication_type" ist? in Ihrem ClientTemplate? –
Wo definieren Sie '.ClientTemplate (" #: communication_type # ")'? Kannst du bitte deinen Controller vom gesamten Grid posten? –