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

how to get the event cheked in Syncfusion : GridCheckBoxColumn ?

 <syncfusion:GridCheckBoxColumn TextAlignment="Center" x:Name="chkImpuesto" AllowEditing="True" HeaderText="{DynamicResource Texto_Impuestos}" MappingName="Impuestos" Changed="chkImpuesto_Changed" />

                             

7 Replies

JG Jai Ganesh S Syncfusion Team October 27, 2015 09:12 AM UTC

Hi Luis,

Thank you for using Syncfusion Products.

We analyzed your query. Due to GridCheckBoxColumn behavior it does not fire any Editing events. Instead of editing events you can use CurrentCellvalueChanged event to get fired when the check box value is changed.
Code Example [C#]:

private void grid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args)

     {

            SfDataGrid grid = sender as SfDataGrid;

            int columnindex = grid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex);

            var column = grid.Columns[columnindex];

            if (column.GetType() == typeof(GridCheckBoxColumn))

            {

                MessageBox.Show("Checkbox value changed ");

            }
     }



We have also prepared a sample based on this and you can download the sample from the below location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/145903/ze/DataGrid-1284954582

Please let us know if you have any query.

Regards,
Jai Ganesh S



LF Luis Fernando replied to Jai Ganesh S October 27, 2015 06:10 PM UTC

Hi Luis,

Thank you for using Syncfusion Products.

We analyzed your query. Due to GridCheckBoxColumn behavior it does not fire any Editing events. Instead of editing events you can use CurrentCellvalueChanged event to get fired when the check box value is changed.
Code Example [C#]:

private void grid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args)

     {

            SfDataGrid grid = sender as SfDataGrid;

            int columnindex = grid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex);

            var column = grid.Columns[columnindex];

            if (column.GetType() == typeof(GridCheckBoxColumn))

            {

                MessageBox.Show("Checkbox value changed ");

            }
     }



We have also prepared a sample based on this and you can download the sample from the below location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/145903/ze/DataGrid-1284954582

Please let us know if you have any query.

Regards,
Jai Ganesh S


Now as I get the value of GridCheckBoxColumn?


JG Jai Ganesh S Syncfusion Team October 28, 2015 09:03 AM UTC

Hi Luis,

You can get the CheckBoxColumn value in CurrentCellValueChanged event by using the Rowindex like the below code example,
Code Example [C#]:

private void grid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args)

        {

            SfDataGrid grid = sender as SfDataGrid;

            int columnindex = grid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex);

            var column = grid.Columns[columnindex];

            if (column.GetType() == typeof(GridCheckBoxColumn))

            {

                var rowIndex = this.grid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex);

                var record = this.grid.View.Records[rowIndex].Data as Student;

                var value = record.IsCheck;

            }
        }   



We have also modified the  sample based on this and you can download the sample from the below location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/146186/ze/DataGrid518228312

Regards,
Jai Ganesh S


GU Guadalupe March 27, 2019 06:30 PM UTC

Hello
I've problem with CurrentCellValueChangedEventArgs



DY Deivaselvan Y Syncfusion Team March 28, 2019 12:30 PM UTC

Hi Guadalupe,

Thank you for contacting Syncfusion support.

We are unable to get clear details on your issue with the given details. Kindly update us with more clear details on your issue description and its replication procedure to understand the issue at our end. Thereby we could analyze and provide you with the appropriate solution at the earliest.

Regards,
Deivaselvan 



TK Tom Krieg January 6, 2020 04:37 AM UTC

Whilst this is an old thread, I also have the same problem. I need to detect when checkbox cell changes in winforms sfdatagrid and I tried your solution but it doesn't work.
Visual Basic
Private Sub sfdatagrid_CurrentCellValueChanged (ByVal sender as object, ByVal e as CurrentCellValueChhangedEventArgs) Handles sfdatagrid.CurrentCellValueChanged

gives the following errors:

Type CurrentCellValueChangedEventArgs is not defined
Event CurrentCellValueChanged is not defined.

Syncfusion 17.1.0.47


SA Saravanan Ayyanar Syncfusion Team January 7, 2020 12:10 PM UTC

Hi Tom, 
 
Thank you for using Syncfusion control. 
 
We  have checked the reported scenario. You can achieve the requirement to detect the checkbox cell changes by using  sfDataGrid.CellCheckBoxClick event. Please refer the below code snippet. 
 
AddHandler Me.sfDataGrid1.CellCheckBoxClick, AddressOf SfDataGrid1_CellCheckBoxClick 
 
Private Sub SfDataGrid1_CellCheckBoxClick(ByVal sender As Object, ByVal e As CellCheckBoxClickEventArgs) 
    MessageBox.Show("OldValueStatus " & e.OldValue.ToString() & vbCrLf & "NewValueStatus   " & e.NewValue.ToString()) 
End Sub 
 
Please find the sample link below, 
 
 
Please let us know, if you require further assistance on this. 
 
Regards, 
Saravanan A. 


Loader.
Live Chat Icon For mobile
Up arrow icon