Breaking News

Editors Picks

Monday, January 9, 2012

How to Generate Dynamic Serial Number for GridView Control with Paging?


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:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" >
  <Columns>
<asp:TemplateField HeaderText="SNO.">
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
ItemTemplate>
asp:TemplateField>
  Columns>
asp:GridView>

No comments :

Post a Comment

Contact Us

Name

Email *

Message *