Kendo Grid - Pager Showing 0 Instead of Current Page

1 Answer 71 Views
Grid Pager
Rex
Top achievements
Rank 1
Rex asked on 23 Aug 2021, 04:24 PM

I am upgrading my application to Telerik UI for AspNet.Core v2021.2.616.  I got the grid to display data, but the grid pager component shows 0 as the current page and the pager navigation controls are disabled

 

Here is the view

<text>

<kendo-grid name="usersGrid" on-data-bound="UserMaintenance.onDataBound" selectable="true">

	<datasource type="DataSourceTagHelperType.Ajax" page-size="5">
		<transport>
			<read url="@Url.Action("GetUsers""User"new { Area = "Admin" })" type="post" />
		</transport>
		<schema data="data">
		</schema>
	</datasource>
	<columns>
		<column field="userId" title="User Id" width="1" visible="false" html-attributes='new Dictionary<stringobject>{ ["class"] = "primary-key" }' />
		<column field="userName" title="User Name" />
		<column field="stateUserId" title="State User Identifier" />
		<column field="email" title="Email" />
		<column field="isActive" title="Active" template="#= isActive ? 'Yes' : 'No' #" width="100" />
		<column title="Actions">
			<commands>
				<column-command text="Edit" id="edit" name="edit" click="function(e){UserMaintenance.onOpenEditUserModal(e, 'UserId')}" />
				<column-command text="Deactivate" id="deactivate" name="deactivate" click="function(e){UserMaintenance.onOpenDeleteUserModal(e, 'UserId')}" />
				<column-command text="Activate" id="activate" name="activate" click="function(e){UserMaintenance.onOpenActivateUserModal(e, 'UserId')}" />
			</commands>
		</column>
	</columns>
 
	<toolbar>
		<toolbar-button text="Add User" name="Add" template="UserMaintenance.userCustomTemplate" />
	</toolbar>
 
	<scrollable enabled="true" />
	<groupable enabled="true" />
	<sortable enabled="true" />
	<pageable enabled="true" responsive="false" button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20 }"></pageable>
	<filterable enabled="true" />
</kendo-grid>

</text>

Here is the controller method

<text>

public ActionResult GetUsers([DataSourceRequest] DataSourceRequest request, string userSearch)
{
    var users = _uow.UserRepository.GetAll()
        .AsNoTracking()
        .OrderBy(u => u.UserName);
 
    var result = users.ToDataSourceResult(request);
 
    return Json(result);
}

</text>

 

What am I missing?  If this is not enough information, let me know what else you need to see

 

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 26 Aug 2021, 10:25 AM

Hi Rex,

Thank you for the code snippet and details provided.

I am trying to replicate the pointed faulty behavior locally.

The fastest route to getting you up and running is if you could provide a runnable, isolated, sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

In order to help you create the reproducible, I have gone ahead and created a starter project for you. It already has all the dependencies and a view/controller with a Grid.

Please take the following steps:

1. Download, unblock and extract the attached solution
2. Open it in  VS2019 and update the following files with your problematic code
2.1 Controllers/GridController.cs
2.2 Views/Home/Index.cshtml
3. Run the project and confirm that it reproduces the problem at runtime
4. Close VS2019, then open the project in File Explorer and delete the bin and obj folders
5. Zip up the solution and attach it to your next reply.


Looking forward to hearing back from you.

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid Pager
Asked by
Rex
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or