Several Problems with this control I think

1) It seems there is no support for data validation for bool fields (checkbox). Why would you not add this by now?
2) Row Validation with class implementing INotifyDataErrorInfo doesn't work.
3) Validation isn't consistent with add row.
4) Stacked Header borders don't draw properly.

Question: How can I validate a checkbox where its validity is dependant on other bool values in the row or it selection may invalidate other data in the row?
Opinion: Row validation should provide a way to do cheks of inter-dependent cell values within that row and return a custom message for display. The single constant value is relatively useless.


1 Reply

AR Amal Raj U Syncfusion Team April 16, 2018 12:15 PM UTC

Hi Jack, 

Thanks for using Syncfusion products. 

Query 
Response 
It seems there is no support for data validation for bool fields (checkbox). Why would you not add this by now? 
Currently we don’t have support for validation and its events for CheckBox columns since it is not considered as editable.  

Please let me know, whether your requirement is like the below WPF KB? 

WPF KB: 
Row Validation with class implementing INotifyDataErrorInfo doesn't work. 
We have prepared a simple sample with implementing INotifyDataErrorInfo and the validation works fine in our side. Please refer to the below attached sample.  

If the issue still exists, please let us know the case of the issue or update us more details about the issue. 
Validation isn't consistent with add row. 
We have tested the Validation for the AddNewRow with the below cases and it works properly. Please refer to the below cases, 
  • Modified value updated in cell of AddNewRow.
  • CurrentCellValidating event fired properly when moving to another cell in AddNewRow with editing the cell.
  • RowValidating event fired properly when clicking or moving to another row from AddNewRow after editing the cells.

If the issue still exists, please let us know the case of the issue or update us more details about the issue. 
Stacked Header borders don't draw properly. 
We have created a simple sample with Stacked Headers and the borders of the stacked headers are rendered properly. Please refer to the below image and the attached sample. 

 


Could you please update us, how you have created the Stacked Headers or the image of the issue? 
How can I validate a checkbox where its validity is dependant on other bool values in the row or it selection may invalidate other data in the row? 
Other check box column values in a row or invalidating the other cell is a row can be achieved with processing the SfDataGrid.CellCheckBoxClick event. Please refer to the below code example, 

Code Snippet: 
// Event wiring. 
this.sfDataGrid1.CellCheckBoxClick += SfDataGrid1_CellCheckBoxClick; 

private void SfDataGrid1_CellCheckBoxClick(object sender, CellCheckBoxClickEventArgs e) 
    var mappingName = e.Column.MappingName; 
    var record = e.Record as OrderInfo; 
    var newValue = e.NewValue == CheckState.Checked ? true : false; 

    if (mappingName == "IsShipped") 
        record.IsDelivered = newValue; 
    else if (mappingName == "IsDelivered") 
        record.IsShipped = newValue; 

The above code example updates the cell value of another check box column in a row. In this way, other check box columns value can be checked to change the current check box value. 


Sample Link: 
 
Regards, 
Amal Raj U. 


Loader.
Up arrow icon