--- sidebar_position: 7 title: Blazorise pagination --- ## Use pagination with Blazorise Now that you have a functional grid, it is possible that your application returns a lot more data to you, in order to keep a fluid display, it is possible to set up pagination. ## Add paging to grid In order to set up pagination open the `Pages/List.razor` file and add the highlighted code to your page: ```cshtml title="Pages/List.razor" @page "/list" @using Minecraft.Crafting.Models

List

@(string.Join(", ", ((Item)context).EnchantCategories)) @(string.Join(", ", ((Item)context).RepairWith)) ``` ## Add paging code Open the `Pages/List.razor.cs` file and modify the code as follows: ```csharp title="Pages/List.razor.cs" public partial class List { private List items; private int totalItem; [Inject] public HttpClient Http { get; set; } [Inject] public NavigationManager NavigationManager { get; set; } private async Task OnReadData(DataGridReadDataEventArgs e) { if (e.CancellationToken.IsCancellationRequested) { return; } // When you use a real API, we use this follow code //var response = await Http.GetJsonAsync( $"http://my-api/api/data?page={e.Page}&pageSize={e.PageSize}" ); var response = (await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-data.json")).Skip((e.Page - 1) * e.PageSize).Take(e.PageSize).ToList(); if (!e.CancellationToken.IsCancellationRequested) { totalItem = (await Http.GetFromJsonAsync>($"{NavigationManager.BaseUri}fake-data.json")).Count; items = new List(response); // an actual data for the current page } } } ```