Sandy
Sandy

Reputation: 47

Prevent Last row in DatagridView from Sorting

i have a datagridview which is populated with a DataTable & i am inserting a row to show sum of 1 column values inside it (in DataTable) and then providing it as Datasource to the datagridview.

the last row is nothing but "Total : %Number of records% %Sum Value%".

when the gridview sorts the above row is also sorted which i guess is obvious.

how can i prevent the above from sorting.

is there sumthing wrong in inserting a summary row in datatable itself, if so whts the other option to have similar functionality.

Thanks

Upvotes: 0

Views: 648

Answers (1)

William
William

Reputation: 749

Try putting the last row's tr element inside a tfoot, this ensures the last row stays fixed as the rest get sorted.

Upvotes: 0

Related Questions