• Auto generate serial number in GridView in ASP.NET

    by  • May 21, 2013 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    Many times we need serial number for our GridView rows. There are different methods to auto generate serial numbers in ASP.NET GridView Control. You can do it programmatically or in TemplateField if GridView control.

    You can simply do it in TemplateField fo GridView Control as you can see first TemplateField below

    We will see next how we can auto generate serial number in next two Template fields of GridView Control. Let’s see RowDataBound Event of GridView Control.

    You can simple set the row index as text of cell or you can get the Label control which we have used in third template field, and set this row index as text of this label. Further more if you are using paging in your GridView control you can use last line of code to auto generate paging.




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply