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 8306 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:
Sexy Web Design - Free 71 Page Preview!
An easy-to-follow guide that reveals the secrets of how to build your own breathtaking web interfaces from scratch.
The Art & Science of JavaScript - Free 100 Page Preview!
For intermediate JavaScript developers who want to take their JavaScript skills to the next level without sacrificing web accessibility or best practice.
100% Free Subscription until Stock lost.View complete list.
Sponsored by