1

I am using a Kendo UI Grid inside a Kendo UI Window in my ASP.NET MVC 4 application. The window that the grid is displayed in is modal.

Here's the definition of the Kendo UI Window.

@(Html.Kendo().Window()
    .Name("BackupSearchResultsPopupWindow")
    .Draggable()
    .Actions(actions => actions.Close())
    .AutoFocus(true)
    .Modal(true)
    .Events(events => { events.Close("OnBackupSearchResultsPopupWindowClose"); })
    .Width(600)
    .Height(400)
    .Title("Requestors matching your search query")
    .Visible(false)

When I display this window, it displays fine and the grid inside it has data, but when I try to sort the grid by any of its columns by clicking on the column header, the grid posts back to its controller action rightly but the modal window is gone and so is the page behind the modal window and the browser is refreshed to a new page that is to have the grid results.

Also, the grid results do not display.

Here is the code inside the razor view that has the window.

@(Html.Kendo().Grid<Backup>()
.Name("MatchingBackupsGrid")
.Columns(col =>
    {
        col.Bound(backup => backup.BackupUId).Title("UID");
        col.Bound(backup => backup.BackupFirstName).Title("First Name");
        col.Bound(backup => backup.BackupLastName).Title("Last Name");
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Selectable(sel =>
    {
        sel.Mode(GridSelectionMode.Single);
        sel.Type(GridSelectionType.Row);
    })
    .DataSource(dataSource => dataSource            
         .Server()
         .Read(read => read.Action("SearchForBackup", "Arr", 
                            new { lastName = ViewBag.SearchTerm }))
         .Model(model => model.Id(b => b.BackupUId)))

         .BindTo(Model)
    )
4

1 回答 1

0

使用浏览器开发工具确保没有 Javascript 错误。一旦纠正了javascript错误,我也遇到了同样的问题,它工作正常。

如果 Kendo 遇到任何 javascript 错误,它将使用服务器发布而不是 Ajax 发布

于 2014-10-01T09:47:15.240 回答