If you want to generate serial number column in data controls just see below:

Gridview: Container.DataItemIndex+1

(For e.g. In gridview

<asp:TemplateField HeaderText=”S.No”>
<ItemTemplate><%#Container.DataItemIndex+1 %></ItemTemplate>
</asp:TemplateField>

)
Datalist:  Container.ItemIndex+1
Formview: Container.PageIndex+1

Advertisements