Wednesday, 16 November 2011

How to add Auto Increment Serial No in Grid View in C#.net

 <asp:GridView ID="GrdDetailreport" runat="server"  AlternatingRowStyle-CssClass="alt" Style="width: 70%"   >
        <Columns>
    <asp:TemplateField HeaderText="Serial Number">
    <ItemTemplate>
        <%# Container.DataItemIndex + 1 %>
    </ItemTemplate>
    </asp:TemplateField>
  
    </Columns>
   
                  </asp:GridView>