Row number added automatically

Row number added automatically

measterbromeasterbro Posts: 33Questions: 9Answers: 0

Is there a way to generate a row number for each row in a DataTable, and then have it be based on whichever column was sorted? For example if a table has 10 rows, the row number column would have 1 - 10 based on the initial sort. Then if a different column was used for sorting by the user, the row number column would be re-generated so it was again 1 - 10.

Here is a link to an example: http://citydynasty.com/Standings/Baseball/MLB/2012.cshtml

In the example the top tables have a blank column which is where the row number would go. The bottom tables have values that come from the SQL query, but they are always tied to a specific column regardless of how the table is sorted by the user.

The debug code is: alofak

This discussion has been closed.