Tuesday, June 26, 2012

add Serial Number in gridview

sometimes we need to add serial numbers in gridview. we can achieve it through following code

            Serial No.</HeaderTemplate>
            <asp:Label ID="lblSRNO" runat="server" 
                Text='<%#Container.DataItemIndex+1 %>'></asp:Label>

This code works as same when we apply paging.
We cannot use this on BoundFields because they support only those objects who have Databinding event

No comments:

Post a Comment