public void MoveRow(int rowIndex, int newIndex) { this.ultraGrid1.Rows.Move(ultraGrid1.Rows[rowIndex], newIndex); }
I am using this method to move the rows in the grid by clicking the check box in the first column. When i append some rows to the grid, the moved rows come to the original position where it was there before moving it.
Problem is ultradatasource is not being updated while moving the rows inside the grid. So the ultradatasource will have original position and append rows just merely append below to it.
Kindly help me in this.
Hi,
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help? Just let me know.
Thank you.
The behavior that i am expecting is, whenever i move the row in the grid, i want the corresponding changes to be get reflected in the data source also. so while refreshing the data in the grid, the moved fields will not get re aligned to original position. How can i achieve this?. Kindly help.
There's no simple way to do this. You would have to watch for changes in the order of rows in the grid and then update the DataSource you are using accordingly. This will be difficult, especially since the UltraDataSource does not have a method to allow you to move a row. So you would have to remove the row and re-insert a new row at the position you want.
The approach I would take is to move the row in the DataSource (by removing the row and adding a new one) and then refreshing the grid by calling grid.Rows.Refresh(ReloadData). That way you don't have to move the row in the grid.