We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the same values in all records when the ComboBox column value is changed?

Platform: WPF |
Control: SfDataGrid |
Published Date: August 13, 2014 |
Last Revised Date: September 30, 2016 |
.NET Framework: 4.5 |
Product Version: 12.1.0.43
Tags: editing, columns

In the SfDataGrid, when a column has same value in more than one row, you can update all those values in the column at once to a newly changed cell value by handling the CurrentCellValidated event. This event has two arguments, sender and CurrentCellValidatedEventArgs.

The CurrentCellValidatedEventArgs has the following properties,

  • NewValue: Gets new value from the edited cell in the DataGrid.
  • OldValue: Gets old value from the edited cell in the DataGrid.
  • Column: Gets the Grid Column of the DataGrid.
  • ErrorMessage: Gets error message to notify the error.
  • RowData: Gets the edited row data.

C#

Here, the CurrentCellValidated event is triggered when current cell moves to another cell. When the MappingName of the Current Cell’s Column is not equal to null and MappingName is CustomerName, then all the cell values that match the old values are changed to new values by using the NewValue and OldValue properties.

The following screenshot displays the updated ComboBox column values.

F:\KB\Images\NewCombo1.png

In the above screenshot, the old value Thomas Hardy is repeated in more than one cell. Thus, Thomas Hardy in the CustomerName column is replaced with the selected value Ana Trujillo. The following screenshot displays the changed value.

F:\KB\Images\UpdatedCombo1.png

Sample Links:

WPF

WRT

SilverLight

UWP

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon