0
我是新的劍道UI的ASP.NET MVC。 我想創建網格並能夠通過點擊放置在工具欄中的按鈕(創建,編輯,更新,保存,放置)來編輯選定的行,而不是在命令列表中。如何實現這一目標?這裏是我的代碼kendo ui mvc 4格編輯選定的行
@(Html.Kendo().Grid<TelerikMVC4.Models.TeacherViewModel>()
.Name("grid")
.HtmlAttributes(new{style = "font-size: 12px"})
.Columns(columns =>
{
columns.Bound(teacher => teacher.Name);
columns.Bound(teacher => teacher.Date).Format("{0:d}");
columns.Command(commands =>
{
commands.Edit().UpdateText("Save").Text("Edit");
commands.Destroy().Text("Delete");
}).Title("").Width(200);
})
.ToolBar(toolbar =>
{
toolbar.Create().Text("New");
}) // The "create" command adds new data items
.Editable(editable => editable.Mode(GridEditMode.InLine)
.Window(window =>
{
window.Title("Edit teacher");
}
)
)// Use inline editing mode
.DataSource(dataSource =>
dataSource.Ajax()
.Model(model =>
{
model.Id(teacher => teacher.TeacherID);
model.Field(teacher => teacher.TeacherID).Editable(false);
})
.Create(create => create.Action("Teachers_Create", "Teacher"))
.Read(read => read.Action("Teachers_Read", "Teacher"))
.Update(update => update.Action("Teachers_Update", "Teacher"))
.Destroy(destroy => destroy.Action("Teachers_Destroy", "Teacher"))
)
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(false)
.ButtonCount(5))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single)))