Auto-generate serial no for Datalist, Repeater, Gridview

We can use DataItemIndex to generate serial no for GridView.


Now, we can’t use DataItemIndex for DataList or a Repeater control. 

For them there is another property called ItemIndex , which will show the anticipated result. 

 syntax for ItemIndex:
<ItemTemplate>
     <%#Container.ItemIndex+1 %>
</ItemTemplate>

0 comments

Post a Comment