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.
Below we have given the sample block of code for your reference.
<asp:GridView ID="GridView1"runat="server"AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="SNO.">
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
ItemTemplate>
asp:TemplateField>
Columns>
asp:GridView>
0 comments:
Post a Comment