Hi Marcio,
Thank you for using Syncfusion Products.
We regret to inform you that, the Events like BeginEdit, EndEdit, CellValidating and RowValidating will not be triggered for GridCheckBoxColumn in SfDataGrid. In GridCheckBoxColumn, we loaded the EditElement directly hence the above events are not supported in GridCheckBoxColumn. However we have prepared the work around for firing the Validated event like the below code example,
Code Example[C#]:
void DataGrid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args) { int rowIndex = args.RowColumnIndex.RowIndex; int columnIndex =this.DataGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex); //We are enabling the RowValidating event if the changes happen in GridCheckBoxColumn if (this.DataGrid.Columns[columnIndex].CellType == "CheckBox") { this.DataGrid.GetValidationHelper().SetCurrentRowValidated(false); } } |
Here we have setting the IsCurrentRowValidated as false using ValidationHelper.SetCurrentRowValidated() method.
Sample Location: http://www.syncfusion.com/downloads/support/directtrac/148928/ze/ValidateTestSfGrid201200701
Please let me know if you have any other concerns.
Regards,
Jai Ganesh S
Hi Marcio,
We regret to inform you that, the CurrentCellValueChanged event will not be trigger for GridComboxBoxColumn and GridTemplateColumn in SfDataGrid. For GridComboBoxColumn, you have to use CurrentCellDropDownSelectionChanged event for notify the value changes and for GridTemplateColumn you have to use separate event as per the control that you have loaded in it. For an example, you have loaded the ComboBoxAdv control where you have you can use SelectionChanged event to notify the selection changed. Please refer the below code example,
C#
void DataGrid_CurrentCellDropDownSelectionChanged(object sender, CurrentCellDropDownSelectionChangedEventArgs args) { int rowIndex = args.RowColumnIndex.RowIndex; int columnIndex = this.DataGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex); //We are enabling the RowValidating event if the changes happen in GridCheckBoxColumn if (this.DataGrid.Columns[columnIndex].CellType == "ComboxBox") { this.DataGrid.GetValidationHelper().SetCurrentRowValidated(false); } }
|
void DataGrid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args) { int rowIndex = args.RowColumnIndex.RowIndex; int columnIndex = this.DataGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex); //We are enabling the RowValidating event if the changes happen in GridCheckBoxColumn if (this.DataGrid.Columns[columnIndex].CellType == "CheckBox") { this.DataGrid.GetValidationHelper().SetCurrentRowValidated(false); } } |
private void MyComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { this.DataGrid.GetValidationHelper().SetCurrentRowValidated(false); }
|
We have prepared a sample as per your requirement and you can download the same from the below location,
Sample : http://www.syncfusion.com/downloads/support/forum/121528/ze/ValidateTest329851855
Regards,
Srinivasan