Hi,
I have an ultragrid as shown in the screen shot below
I am modifying some of the values in the grid like below (highlighted in yellow)
While saving I need to get the modified column names. (Name and Nationality)
Is there any way to find the modified column names?
Thanks in advance
By default, UltraGrid updates rows when a row id deactivated (i.e., user tabs out of that row, or clicks on some other row), or the control loses focus.
When this happens, the BeforeRowUpdate and AfterRowUpdate events fire. You can handle the BeforeRowUpdate event, which gives you a reference to the row being updated, iterate the cells in that row, and check the UltraGridCell.DataChanged property to determine whether a given cell's value was changed since the last update.
Also note that UltraGrid exposes an UpdateMode property, which enables you to change the trigger for updates...for example, you could set this property to 'OnUpdate', and cell values will not be updated until you call the control's UpdateData method. In this scenario, you would declare a global variable, say a list of tuples or whatever, and when you update, add the changed column keys in response to BeforeRowUpdate (the event will fire once for each row that was updated).
Hi Brian,
Can you please attach a working sample demonstrating your idea?
Thanks and regards
Hello,
As Brian suggested you can handle the BeforeRowUpdate event and retrieve the column header caption of each cell that was updated. The code would look something like this:
private void UltraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e){ foreach (UltraGridCell cell in e.Row.Cells) { if (cell.DataChanged == true) { String headerString = cell.Column.Header.Caption; } }}
Let me know if you have any additional questions.