Issue with Datagrid

There seems to be an issue with the Datagrid when there are 2 pages of records and the page 2 only has 1 record and is deleted.

To replicate the issue, I have created a CRUD using Radzen Studio using the autogenerated pages and then for the Datagrid ticked PagerAlwaysVisible and ShowPagingSummary. There are 11 records to display and I navigate to page 2 and delete the 11th record. Now nothing displays in the Datagrid; not even the 10 records that are left. If I click on page 1 in the navigation, still nothing. The Summary does still say there are 10 items so the items exist but I can't navigate to them.

If there are 21 records and I delete the 21st record on page 3, then I have a problem navigating to page 2 but if I navigate to page 1 and then I can navigate to page 2. Seems like I can't navigate to the immediate previous page and that becomes an issue if only 10 items left as there is only 1 immediate previous page.

Appreciate if you would look into this.

Thank you.

Hi @kirank,

Just to confirm. You are using CRUD templates in Blazor Web Assembly application with Radzen IDE, right?

Yes. The only change is for the Datagrid ticked PagerAlwaysVisible and ShowPagingSummary. Using a SQL Server database.

Here is how to avoid this problem - add this code to the Delete button Click event:

This isn't ideal as every time a record is deleted, it goes to Page 1. Based on your code I can modify it so that if the View Count is zero, it goes to the previous page.

However, the page 1 link is displayed in the datagrid and it would be ideal to be able to click on the Page 1 link to go to that page however clicking Page 1 does nothing. The grid still thinks it's on Page 2 and hence the blank page.

Any chance of fixing the datagrid or is it going to be quite involved in which I'll need to add code as above in all my pages

You are right! We can handle this internally in the DataGrid component:

Much appreciated @enchev

Thank you.

Is this getting deployed in the next update?

The update with this fix is already released: