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. Image for the cookie policy date

Grid cell combo box selection change

Hi

How would I access a combo box cell's data when the combo box selection changes without having to leave the cell and trigger the CurrentCellEditingComplete event? If I try to access the data on the CurrentCellChanged event, I can only see the old data in the model. Not the new data.

3 Replies

JO Jonathan January 4, 2019 10:35 AM UTC

Any update on this?


AA Arulraj A Syncfusion Team January 4, 2019 11:00 AM UTC

Hi Jonathan, 

Thanks for using Syncfusion product. 

You can use the CurrentCell.Renderer.ControlValue to get the cell’s current value when using CurrentCellChanged event without moving to next cell. 

C# 
gridControl.CurrentCellChanged += GridControl_CurrentCellChanged; 
 
 
private void GridControl_CurrentCellChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args) 
{ 
    GridControl g = (GridControl) sender; 
 
    string cellValue = ""; 
    if (g != null) 
    { 
        GridCurrentCell cc = g.CurrentCell; 
        GridStyleInfo style = g.Model[cc.RowIndex, cc.ColumnIndex]; 
        switch (style.CellType) 
        { 
            case "ComboBox": 
                cellValue = $"Combo Changed[{cc.RowIndex},{cc.ColumnIndex}] NewValue={cc.Renderer.ControlValue} OldValue={g.Model[cc.RowIndex,cc.ColumnIndex].CellValue}"; 
                break; 
            default: 
                break; 
        } 
    } 
    Console.WriteLine(cellValue); 
} 


Arulraj A 



JO Jonathan January 4, 2019 11:15 AM UTC

Perfect. Thanks a bunch!

Loader.
Live Chat Icon For mobile
Up arrow icon