Auto-generate serial no for Datalist, Repeater

In my previous post I have discussed about how to auto-generate serial no. in a GridView. Extending my previous post, here I am just discussing the same thing for DataList and Repeater controls. I have used DataItemIndex to generate serial no for GridView, which you can find here( 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. ItemIndex is the index number of the DataListItem in the Items collection and index number of the item in the Repeater control in the Items collection. Below is the syntax for ItemIndex-

     <%#Container.ItemIndex+1 %>

It is showing anticipated result for me. If anybody has any better idea then please share in the comment.

20 thoughts on “Auto-generate serial no for Datalist, Repeater

  1. Sir ! Thanks a lot for complimenting..I am so excited to know that you have visited my blog and it will definitely help me in contributing more to the community.

    Believe me Sir, this is the best new year gift for me, even I can’t wish more than this.

    Thanks !

  2. I really really want to take note of this post, “Auto-generate serial no for Datalist, Repeater |
    Technology Talks” on my own web-site. Do you really mind
    in the event I personallydo? Thx ,Elana

  3. Whene I Give Serial No
    On Page Index Change Event the SSerial No No Show It Start From First
    So please help me How to solve this problem

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s