One of my blog readers Robert asked me a question. Is it possible to create a counter field or an auto-generated Row Number in an ASP.NET ListView.
The solution is to add <%# Container.DataItemIndex + 1 %> to the ItemTemplate of the ListView as shown below:
The output with the auto generated serial number/row number is as shown below:
If you are working with the ASP.NET GridView, check this post of mine ASP.NET GridView Tips and Tricks series
Tweet
4 comments:
Thanks, this is just what I was looking for!
Thank you, i'm looking for this
OMG, i was two days looking for a solution for my problem (using radiobutton to select a row in a listview and get the row index clicking in a button) and this is just what I was looking for.
Thank You Sir!
Post a Comment