how to move a row in datagrid up or down?

N

Nicholas Paldino [.NET/C# MVP]

wu,

You can't really do this. You don't move rows in the data grid. What
you have to do is order the items in the source of data so that they are
ordered appropriately.

For data tables, this is the sort order on the DefaultView property, or,
if it is a DataView class itself, it is the sort property on that.

Hope this helps.
 
C

Ciaran

If you did want to do this then you would need to remove the row from the
underlying collection (Datatable, dataview, ilist) and insert it in the new
location.

It isn't a good idea for datasets that you are going to use to update you
database again as I think it might try and delete the row and then re-add it
to your database table.

For bound object collections it probably isnt a crime though

Ciaran
 

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