Wednesday, February 22, 2006

This has taken too long to figure out. If you want to get the current row number of an item being DataBound to a List control ( DataGrid, Repeater, etc ), use this line of code in your aspx code :

<%# Container.ItemIndex+1 %>


And if you want to get the number of records in your DataBound control, do this

<%# YourControlId.Items.Count %>

Where YourControlId is the id of your DataBound control, such as an ASP:Repeater

No comments: