【发布时间】:2014-07-14 21:07:58
【问题描述】:
我想在我的 kendoUI 网格中创建一个自动完成字段。但我在网上找不到任何合适的方式。
这是我的看法:
@(Html.Kendo().Grid<SamuraiListing.Data.Company>()
// Grid Name
.Name("CompanyGrid")
// Declare grid column
.Columns(columns =>
{
// Cretae all the columns base on Model
columns.Bound(r => r.Name);
columns.Bound(r => r.Telephone);
columns.Bound(r => r.Email);
columns.Bound(r => r.GPS);
// Edit and Delete button column
columns.Command(command =>
{
command.Edit();
command.Destroy();
}).Width(200);
})
// Declare ajax datasource.
// CRUD operation are wired back to ASP MVC Controller/Action e.g. HomeController, GetAll
// Set the model Id
.DataSource(datasoure => datasoure.Ajax()
.Model(model => model.Id(record => record.Id))
.Read(read => read.Action("GetAll", "Home"))
.Create(create => create.Action("Add", "Home"))
.Update(update => update.Action("Update", "Home"))
.Destroy(delete => delete.Action("Delete", "Home"))
.PageSize(10)
)
// Add tool bar with Create button
.ToolBar(toolbar => toolbar.Create())
// Set grid editable.
.Editable(editable => editable.Mode(GridEditMode.InLine))
// Set grid sortable.
.Sortable()
// Set grid selectable.
.Selectable()
.Navigatable()
// Set grid pagable.
.Pageable(pageable =>
{
pageable.Refresh(true);
pageable.PageSizes(true);
})
)
假设我想以自动完成方式显示名称列表,我可以在哪里添加我的代码? 我在网上阅读了很多主题和帖子,但没有一个指向 asp.net 包装器。
【问题讨论】:
标签: c# asp.net-mvc-3 autocomplete kendo-grid