我想在kendoGrid()
(编辑弹出窗口)中显示一些信息,但是当我运行项目时,它不会加载数据并且网格是空的。
我该怎么做???
@(Html.Kendo().Grid<TelerikTestProject.Models.SoftwareInformation>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.SoftwareID);
columns.Bound(p => p.Name).Width(100);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(s =>s.SoftwareID ))
.Create(update => update.Action("Create", "SoftwareInformations"))
**.Read(read => read.Action("Index", "the name of my controller"))**
.Update(update => update.Action("EditingPopup_Update", "Grid"))
.Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
)
)
<script type="text/javascript">
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
</script>
答案 0 :(得分:0)
我以这种方式完成了我的申请 -
@using Kendo.Mvc.UI
@model IEnumerable<DFMS_MVC5.Models.DIM_LINKS>
@(Html.Kendo().Grid<DFMS_MVC5.Models.DIM_LINKS>(Model)
.Name("grid")
.Columns(columns => {
columns.Bound(p => p.ID_DIM_LINK);
columns.Bound(p => p.LINK_NAME);
columns.Bound(p => p.LINK_DESC);
columns.Bound(p => p.CREATE_TIME_STAMP).Format("{0:MM/dd/yyyy}");
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
)
看看这是否有帮助。