Hello:
Can you insert new rows on top of the grid? What I would like to do is basically to set the data source to be a DataTable and be able afterwards to insert rows/col on top of the first row. Is this possible? If not what would be a sensiblie approach to achieve this?
Thanks,
Mihail
If you are using a datatable as your datasource and you don't have any special sorting happening you can simply insert your record at the top of your datatable.
datatable.rows.insert(rowToAdd,0)
Brandon
Actually, I don't think this works. You can call Insert on the data table and it wil insert the row at the position you specify. But when the DataTable fires the ListChanged notification, it does not pass in the correct index of the newly-added item, it always passes in the last index of the list, so the row will appear in the grid at the bottom.
One thing you could do, though, is use the grid.Rows.Move method to move the row after it is added.