Tôi đang làm việc với KendoUI MVC trong MVC3.Làm cách nào tôi có thể đặt và nhận giá trị của danh sách thả xuống trong lưới trong KEM UI UI MVC?
Tôi đã quản lý để có danh sách thả xuống trong cột lưới. Nhưng tôi không có đầu mối về cách thiết lập giá trị đã chọn, và khi tôi lưu nó không lưu giá trị đã chọn của tôi.
Lưới
@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>
Các 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))
Bạn có nhận được y giải pháp? Tôi có cùng một vấn đề. Tôi có thể hiển thị văn bản trong danh sách thả xuống, Làm cách nào tôi có thể đặt giá trị. –
Dường như vấn đề được giải quyết, bạn có thể làm rõ trường '' communication_type '' là gì? trong clientTemplate của bạn? –
Nơi bạn định nghĩa '.ClientTemplate (" #: communication_type # ")'? Bạn có thể vui lòng gửi bộ điều khiển của bạn của toàn bộ lưới điện. –