Hi all,
I am working with a grid with insert update delete function. When I insert a row, it will appear at the most bottom of the grid, How can I perform the sorting itself and let the row place the correct place of the grid?
RegardsAndrew
Hi Mike, I have done this with the following procedure:
For insert row:
I add a blank row (with default value) in the datasource, then move to the current position of the grid with setting the ActiveRowScrollRegion.FirstRow
Since the grid is sorted in different order, after user insertion, the row should moved accoring to the position from the current sort column.
So, after insert, I run "Grid.DisplayLayout.Bands(0).SortedColumns.RefreshSort(False)
And now it works.
Regards
Andrew
Hi Andrew,
It depends who is doing the sorting. Are the grid rows sorted, or are you sorting the data source?
There is no functionality in the grid to insert a row. Most data sources, such as a DataTable, allow you to insert a row, but the BindingManager does not return the proper index of the added row in this case, so the grid doesn't know it wasn't added to the bottom.
If you want to simply re-sort the grid, you can use the RefreshSortPosition method on the row or the Refresh method on the grid's SortedColumns collection.