how to add serial number in quickgrid blazor

Rahul Salokhe 0 Reputation points
2024-07-23T17:19:21.51+00:00

how to add serial number in quickgrid blazor

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,549 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jerry Fu - MSFT 666 Reputation points Microsoft Vendor
    2024-07-26T08:10:45.9366667+00:00

    Hi Rahul Salokhe,

    If you just want add increment number to the grid, you could try following:

    @page "/"
    @using Microsoft.AspNetCore.Components.QuickGrid
    <QuickGrid Items="items" RowsPerPage="10">
        <TemplateColumn Title="Serial">@(count++)</TemplateColumn>
        <PropertyColumn Property="@(item => item.Name)" Title="Name" />
    </QuickGrid>
    @code {
        private int count= 1;
        private IQueryable<Item> items= new[]
        {
            new Item { Name = "Tom" },
            new Item { Name = "Kite" },
            new Item { Name = "Jack" },
        }.AsQueryable();
        public class Item
        {
            public string Name { get; set; }
        }
    }
    

    This way you could display a number without changing the entity.

    User's image


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.