Sorting a Datagridview

A

amit.vasu

Hi

I have a datagridview control which I am binding to a datatable. Before
binding to a datatable I am adding one row in the datatable for Total
and populating data in that row at runtime.

Now when user click the header of the column data gets sorted. I always
want the row which is displaying TOTAL at the end.

I have scenario as mentioned below. Is there a way to keep the total
row always at the end ?
I mean sorting should always be the last row in datagrid.

------------------------------------------------
col1 col2
------------------------------------------------
column1 1000
column2 1500

Total 2500

-----------------------------------------------------------------
 
G

Guest

You need to manually remove/add you total row before/after sorting, or don't
use the total at all - it that case I suggest to use DataTable.Select to set
the function calculating your total number
I have a datagridview control which I am binding to a datatable. Before
binding to a datatable I am adding one row in the datatable for Total
and populating data in that row at runtime.

Now when user click the header of the column data gets sorted. I always
want the row which is displaying TOTAL at the end.

I have scenario as mentioned below. Is there a way to keep the total
row always at the end ?
I mean sorting should always be the last row in datagrid.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
A

amit.vasu

Hi Michael

Thanks for your reply. I think I will go with manually remove/add total
row.

I was just wondering do you have any sample code for that ?

Regards

Amit
 
G

Guest

Try to do it by your own way, it's more intriguing :)

Hi Michael
Thanks for your reply. I think I will go with manually remove/add total
row.
I was just wondering do you have any sample code for that ?
Regards
Amit

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top