In my application data entities implement both INotifyDataErrorInfo and IDataErrorInfo interfaces. When I bind these entities to the GridView control and perform validation I get each error listed twice in the error tooltip. I believe it happens in GridViewBoundColumnBase.GetDataErrorValidationErrors() method which collects errors using both interfaces mentioned above.
Can I somehow disable validation via IDataErrorInfo interface?
It's WPF application, .NET 4.5, Telerik contols version 2012.3.1017.45
Thanks,
Victor
8 Answers, 1 is accepted
Unfortunately, there is no way to disable validation only of IDataErrorInfo interface. The possible approach is to set the GridView's property ValidatesOnDataErrors to None, but in this way GridView will remove both listed errors. So, I suggest you to use only INotifyDataErrorInfo, considering it has some benefits than IDataErrorInfo.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I wish I could use INotifyDataErrorInfo only but unfortunately I can't as the entities code is generated by the ORM tool.
Do you plan to separate control over validation using INotifyDataErrorInfo and IDataErrorInfo in future releases? Like adding separate properties ValidatesOnDataErrors and NotifiesOnDataErrors or something? If you do I can live with the duplicate errors for now (or remove the duplicates manually if possible).
Regards,
Victor
As it turns out, for now we do not plan to add separate control over validation using INotifyDataErrorInfo and IDataErrorInfo, but this feature might be of interest to other customers as well. Therefore, I have logged this feature request in our Public Issue Tracking System so other people can vote for it. If it gets more votes, we will consider scheduling it for a future release. Here is the link to the PITS entry.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Hello Yoan,
Currently, I have ran into the same issue as Victor, but your link to the PITS entry no longer works. How is the status of this request?
Also, I found that additionally to the INotifyDataErrorInfo and IDataErrorInfo errors, RadGridView also checks for System.ComponentModel.DataAnnotantions attributes, which I also use in my scenario. So, in my scenario, I actually get triple validation errors.
Regards,
Milan
Actually, with the current version RadGridView does not allow the same errors to appear multiple times (from IDataErrorInfo and INotifyDataErrorInfo). I have attached a sample project where you can observe this behavior. Generally, you can decide which one of the validation approaches to use.
Regards,
Yoan
Telerik
Hi Yoan,
If this was true (RadGridView only showing one error, and not both IDataErrorInfo and INotifyDataErrorInfo) without any additional settings, that would be perfect. But I just now tried with your sample project, and it still shows all 3. I tried with "Telerik UI for WPF Q2 2015 SP1".
I have upgraded your original test project to .NET 4.5 and fixed it, and would like send it back to you, how do I do that?
Regards,
Milan
Can you please send us the updated project through a support ticket, so that we can be sure that we are on the same page? Tickets can have up to 20 MB zip attachments are enable 24 hours priority support.
Regards,
Ivan Ivanov
Telerik
For reference, I am linking related information:
Support ticket: 965824, "GridView shows errors from multiple validation interfaces at the same time "
Public feedback entry: http://feedback.telerik.com/Project/143/Feedback/Details/168483-validationmodes-property-that-indicates-what-type-of-validation-input-should-be-p