This is a migrated thread and some comments may be shown as answers.

Grid Paging in Razor Page

3 Answers 241 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mihail
Top achievements
Rank 1
Mihail asked on 23 Oct 2018, 03:05 PM

Hi guys,

I need some help solving a pagination problem I have with my grid in a Razor page.

I using 2 Kendo Grids in a Razor page. Second grid (child grid) is a detail grid populated when user expends rows on the parent grid.

Pagination on the child grid seems not working. It always returns first page. Doing some debugging I observed that even if the page is sent correctly as a string parameter (...&page=3&...) it doesn't get into request.Page property (this is always 1). Please see my UI code below and the screenshots of the my debugging attached.

Thanks,

Mihai

 

 

<script id="template_table" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<TargetTableViewModel>()
                          .Name("grid_target_#=TargetId#")
                          .Columns(columns =>
                          {
                              columns.Bound(t => t.TableId).Title("ID").Width(100);
                              columns.Bound(t => t.TableName);
                              columns.Command(command => command.Destroy()).Width(150);
                          })
                          .ClientDetailTemplateId("template_field")
                          .DataSource(dataSource => dataSource
                              .Ajax()
                              .PageSize(25)
                              .Model(model => model.Id(t => t.TableId))
                              .Read(read => read.Action("Targets", "MappingPages", new { handler = "TargetTables", targetId = "#=TargetId#" }).Type(HttpVerbs.Get))
                              .Destroy(delete => delete.Action("Targets", "MappingPages", new { handler = "DeleteTargetTable" }).Data("sendAntiForgery").Type(HttpVerbs.Post))
                              .Events(events => events.RequestEnd("onRequestEnd('#=TargetId#')"))
                              .ServerOperation(true)
                          )
                          .Pageable(pageable => pageable.ButtonCount(5))
                          .Sortable()
                          .ToClientTemplate())

</script>

3 Answers, 1 is accepted

Sort by
0
Mihail
Top achievements
Rank 1
answered on 23 Oct 2018, 03:08 PM

Can an admin move my post to the right location?Thanks.

https://www.telerik.com/forums/aspnet-core-ui/grid

0
Georgi
Telerik team
answered on 25 Oct 2018, 11:47 AM
Hi Mihail,

The described behavior is expected as the request is GET. The `page` route value is used by the razor pages engine. The path to raozor page is added to the route diccionary values as a route value with the page key.

As a workaround I can suggest you to change the type of the request to POST.


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Mihail
Top achievements
Rank 1
answered on 26 Oct 2018, 07:16 PM

Thanks. That helped.

 

Tags
Grid
Asked by
Mihail
Top achievements
Rank 1
Answers by
Mihail
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or