3 Answers, 1 is accepted
Currently the Validation in RadDataForm can be achieved either if your item implements ISupportEntityValidation or if you provide the implementation of the interface through the RadDataForm.EntityProvider. I have prepared a sample project which demonstrates the second approach. Please, see the attached file.
I hope this helps. Let me know should you need further assistance.
Regards,
Ivaylo Gergov
Telerik by Progress
This helped me get the basic structure in place, but I still don't see how to use Data Annotations from my model in validation.
I could create hardcoded validation for each form in my application, but thats not really a valid solution.
In ValidatePropertyAsync I can access the Entity object and its properties, but I can't access its annotations. I can see them via Reflection, but not utilize them.
Here's what I'm seeing
[Telerik.Data.Core.Display(Header = "Value")]
[Telerik.Data.Core.Required]
[StringLength(3)]
public string SomeValue
The "Required" annotation sets "IsRequired" on the property that I can use in validation. How do I access the StringLength annotation and use it in the validation process?
Sorry for the late response.
Through the Entity you have access to your business item. For example:
var item = entity.GetEntityProperty(
"Value"
).DataItem;
I hope this helps.
Regards,
Ivaylo Gergov
Telerik by Progress