Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
Move Rows in UltraWinGrid and in Datasource table
posted

  I have a UltraWinGrid bound to a model(which holds the dataset) , through a BindingSource.  I have 2 buttons, 'Up' and 'Down' to move rows in the grid. I want to move those rows in the underlying table also, but by using RefreshBinding or events,smth like that,  not by moving the rows by code and then rebind the grid to the table. Pleas help, I've tried everything and it just move the selection in the grid.

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    Moving rows in the DataTable is not something that the grid can do - that would have to be done in code. I'm not aware of any methods on the DataTable which make this easy to do. My guess is that you would have to remove the row from the data table and then re-insert it at the correct point.

    I tried this out and the grid seems to update with the new order just fine - as long as the grid is not sorted.

    For example, if my grid is bound to a DataTable called dt1, this moves row 2 to the first position in the table.


                DataRow row = this.dt1.Rows[2];
                this.dt1.Rows.Remove(row);
                this.dt1.Rows.InsertAt(row, 0);

Children