Home Forums WinForms controls Xceed Grid for WinForms OnDataRowsChanged , correct way of using this?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14534 |

    Hello,

    I have my grid which is filled with bound, and unbound columns. When the grid is initialized, the OnAddingDataRows is fired.

    This event adds specific unbound celldata for the bound columns.

    Now when I edit a record through the databinding current row (seperate form on top of grid), the grid bound columns get updated with the correct data, however the unbound columns remain on their old values (which is normal behaviour).

    Which event should I use to accomplish changing the unbound data for the changed row? And how can I retrieve the current row in this event.

    Thanks in advance!

    Imported from legacy forums. Posted by opicron (had 2934 views)

    User (Old forums)
    Member
    Post count: 23064

    Just to mention that I have thought about this. I’ll provide the solution which I am using now.

    I’ve added a CurrentChanged event to my bindingsource which triggers after the row is saved.

    In this event I am able to set the unbound columns of the currently selected grid row.

    This approach works, however I would like to implement this in a different manner so the grid is updated with the correct information right away.

    Imported from legacy forums. Posted by opicron (had 369 views)

    User (Old forums)
    Member
    Post count: 23064

    I meant CurrentItemChanged, which triggers for each cell in the datarow (with DataRowState==modified), unfortunatly

    Imported from legacy forums. Posted by opicron (had 382 views)

    User (Old forums)
    Member
    Post count: 23064

    You can handle the DataRowsChanged event, and use the CurrentRow to get the row being edited :

    gridControl1.DataRowsChanged += new EventHandler(gridControl1_DataRowsChanged);

    private void gridControl1_DataRowsChanged(object sender, EventArgs e)
    {
    if( gridControl1.CurrentRow.GetType() == typeof( Xceed.Grid.DataRow ) )
    {
    ( ( Xceed.Grid.DataRow )gridControl1.CurrentRow).Cells[ 1 ].Value = “changed value”;
    }
    }

    Imported from legacy forums. Posted by André (had 3999 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.