Hi,
It would be extremely useful to have an virtual method that is called during the form's Validation process, that could be overridden to provide custom validation results to be injected into the ValidationSummary in place of the form's own validation. I've taken a look at some of the code and something like the following would be great. This is a small change to the existing code which I don't think would have any impact on other existing functionality:
/// <summary>
/// Checks if data current item is valid .
///
/// </summary>
///
/// <returns/>
public bool ValidateItem()
{
CollectionExtensions.RemoveItems<ErrorInfo>((ICollection<ErrorInfo>) this.validationErrors, (IEnumerable<ErrorInfo>) new List<ErrorInfo>(Enumerable.Where<ErrorInfo>((IEnumerable<ErrorInfo>) this.validationErrors, (Func<ErrorInfo, bool>) (ve => ve.IsItemLevelValidationError))));
List<ValidationResult> validationResults = new List<ValidationResult>();
if (this.CurrentItem != null)
{
try
{
validationResults.AddRange(GetValidationResults())
}
catch
{
return true;
}
}
CancelEventArgs e = new CancelEventArgs();
this.OnValidatingItem(e);
if (e.Cancel)
return false;
this.PopulateValidationErrors(validationResults);
return !EnumerableExtensions.IsNotEmpty((IEnumerable) this.validationErrors);
}
protected virtual IEnumerable<ValidationResult> GetValidationResults()
{
Validator.TryValidateObject(this.CurrentItem, new ValidationContext(this.CurrentItem, (IServiceProvider) null, (IDictionary<object, object>) null), (ICollection<ValidationResult>) validationResults, true);
}
8 Answers, 1 is accepted
This sounds like a great improvement in terms of usability. We will do our best to research it for the future releases of our controls. I am adding 1000 Telerik points to your account.
Regards,
Ivan Ivanov
Telerik
Since it will improve the usability of RadDataForm, we will do our best to include the feature in the next official Q release (Q2 2016).
Regards,
Ivan Ivanov
Telerik
I am afraid that we did not manage to add it for the official release, so we left it for the next one. In case that we finish it earlier and we are confident that we can release it in an internal build, I will drop a line in this thread.
Regards,
Ivan Ivanov
Telerik
Please excuse us for the delay.
I can ensure you that this feature request is planned for our next official release.
Thanks in advance for your understanding.
Regards,
Stefan X1
Telerik by Progress