# Adding Row Numbers to a Grid Column

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Telerik UI for ASP.NET MVC Grid</td>
 </tr>
 <tr>
  <td>Progress Telerik UI for ASP.NET MVC version</td>
  <td>Created with the 2022.2.621 version</td>
 </tr>
</table>

## Description

How can I implement row numbers in a Telerik UI for ASP.NET MVC Grid?

## Solution

To achieve the desired scenario, use the [`page()`](https://docs.telerik.com/kendo-ui/api/data/datasource/methods/page) and [`pageSize()`](https://docs.telerik.com/kendo-ui/api/data/datasource/methods/pagesize) methods of the Data Source.

```Razor Grid.cshtml
        @(Html.Kendo().Grid<App.Models.OrderViewModel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Template(@<text></text>).ClientTemplate("#= getRecord() #");
                columns.Bound(p => p.OrderID).Filterable(false);
            })
            .Pageable()
            .Events(ev=>ev.DataBinding("onDataBinding"))
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(20)
                .Read(read => read.Action("Orders_Read", "Grid"))
            )
        )
```

```JS script.js
    var record = 0;
    function getRecord() {
        record += 1;
        return record
    }
    function onDataBinding() {
        record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
    }
```

To see a complete example of the aforementioned approach, refer to the following [Telerik REPL](https://netcorerepl.telerik.com/mnaCPzYf29fek3Mu39) example.

## More ASP.NET MVC Grid Resources

* [ASP.NET MVC Grid Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/overview)

* [ASP.NET MVC Grid Demos](https://demos.telerik.com/aspnet-mvc/grid/index)

* [ASP.NET MVC Grid Product Page](https://www.telerik.com/aspnet-mvc/grid)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Client-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/grid)

* [Server-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/grid)

* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)

* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
