Adding Row Number Column to LINQ to SQL Query or... RRS feed

  • Question

  • I have a database query that returns a list of items, and I'm binding the result to a listview. In that list view I'd like to have row numbers 1., 2., 3. etc, that will work with paging, so it'll show you progressing item nubmers as you page.

    You can use the Row_Number() method in t-sql to get the row numbers, is there any way to create a row number column with a linq expression? Is there another way to trap a record number form within the listview? Container.DataItemIndex doesn't work across paged pages.

    Thank you for your help,

    Sunday, July 13, 2008 10:11 AM