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 "); } |
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?
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; } |
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 |