SiteMap  | About    

Auto Generate Row Number in GridView

Gridview row index number

The GridView control is the successor to the DataGrid and extends it in a number of ways. While developing GridView control in ASP.NET, programmers often requires to display row number in GridView controls.

row-number in gridview


In this article I have used Microsoft's Pubs database for sample data. You can download it free from the following link.


Auto Generate Row Number in GridView

It is a common requirement that GridViews to have the first column just be a number identifying the row. Because of doing this implementation, the user can see the number of rows returned by scrolling to the end of the GridView. By adding a single piece of code you can add a row number column to your GridView Control.

row-index in gridview

The following source code show how to create a row number column field to your Asp.Net GridView


C# Source Code

VB.Net Source Code (C) 2019    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.