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(http://tiny.cc/f04y7). 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-
<ItemTemplate> <%#Container.ItemIndex+1 %> </ItemTemplate>
It is showing anticipated result for me. If anybody has any better idea then please share in the comment.
Excellent contribution!
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 !
its awesome ,,
it helped me alot thanks….
Thanks Ekta for such kind words. Glad to know that it helped you.
Create…………..
Thank Suveendu
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
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
Hari, are you talking about Gridview?
If yes then my previous post may be useful to you. Please check this https://suvendugiri.wordpress.com/2011/11/26/auto-generate-serial-no-for-gridview/
In case any further help is required, please feel free to ask.
Thanks for visiting !
Excellent, its working…
Thanks.
Thanks Kashif !
Sir Also i have faces this problem in a reapeter.but when i search at first your answer is coming.so thanku sir.
Thanks Satya for visiting 🙂
what if i need 2 digit serial no. ?
@punit, you may try this-
In case, you need further assistance, please feel free to contact me.
Thanks for visiting !
Thanks !!
THANK BRO
once i click in save button auto serial no not displayed in grid view
Great… keep sharing your knowledge to community.
on applying paging in datalist on next page serial no is not show correctly
What if data is showing in paging.