Skip to content

Commit 9366a7b

Browse files
ES-976509 - Resolve Issues in Public Syncfusion Code Examples for DataGrid XAML Controls
1 parent cba7ad7 commit 9366a7b

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
# How to change value of other column while changing the value in combobox column in winforms datagrid?
2-
This example illustrates how to change value of other column while changing the value in combobox column in winforms datagrid
1+
# How to Change Value of Other Columns While Changing the Value in a Combobox Column in WinForms DataGrid?
2+
3+
This example illustrates how to change value of other column while changing the value in combobox column in [WinForms DataGrid](https://www.syncfusion.com/winforms-ui-controls/datagrid) (SfDataGrid).
4+
5+
You can change the value of other columns when changing value in GridComboBoxColumn of a row using the [CellComboBoxSelectionChanged](https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.DataGrid.SfDataGrid.html#Syncfusion_WinForms_DataGrid_SfDataGrid_CellComboBoxSelectionChanged) event.
6+
7+
#### C#
8+
9+
``` csharp
10+
this.sfDataGrid1.CellComboBoxSelectionChanged += sfDataGrid1_CellComboBoxSelectionChanged;
11+
12+
void sfDataGrid1_CellComboBoxSelectionChanged(object sender, CellComboBoxSelectionChangedEventArgs e)
13+
{
14+
if (e.GridColumn.MappingName == "ShipCityID" && e.SelectedIndex == 0)
15+
(e.Record as OrderInfo).ShipCountry = "Canada";
16+
}
17+
```
18+
#### VB
19+
20+
``` VB
21+
AddHandler Me.sfDataGrid1.CellComboBoxSelectionChanged, AddressOf sfDataGrid1_CellComboBoxSelectionChanged
22+
23+
Private Sub sfDataGrid1_CellComboBoxSelectionChanged(ByVal sender As Object, ByVal e As CellComboBoxSelectionChangedEventArgs)
24+
If e.GridColumn.MappingName = "ShipCityID" AndAlso e.SelectedIndex = 0 Then
25+
TryCast(e.Record, OrderInfo).ShipCountry = "Canada"
26+
End If
27+
End Sub
28+
```

0 commit comments

Comments
 (0)