0
votes

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

1
it's hard to customize this behavior because you use a DataTable as the DataSource, if there is not any binding, we can tweak it a little but when using binding, all the sorting will depend on the underlying source. - King King
@King King yeah thts wht i have realised . wht else can we do in such cases. - Sandy
well i have removed it from there as you can not prevent it from getting sorted. - Sandy

1 Answers

0
votes

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