AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How to Generate Dynamic Serial Number for GridView Control with Paging?
Posted by Moderator1 on  3/21/2009 10:05:53 AM 4173 Views
It is very simple to add serial or sequential number column in a GridView control. Just create TemplateField column in the GridView and add Container.DataItemIndex+1 as inline code. That's it.

Below we have given the sample block of code for your reference.


<asp:TemplateField HeaderText="S/N" >
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
</ItemTemplate>
</asp:TemplateField>

The above code will also work for GridView control's with Paging.

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Backup and Recovery Best Practices for Microsoft SQL Server 2005
To help you choose from among the available configuration options and backup and recovery procedures, HP has conducted extensive laboratory tests to determine best practices.
Web Application Security — How to Minimize Prevalent Risk of Attacks
Vulnerabilities in web applications are now the largest vector of enterprise security attacks.
100% Free Subscription until Stock lost.View complete list.
Sponsored by