This is a migrated thread and some comments may be shown as answers.

Cell.Errors not clearing

2 Answers 123 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 22 Aug 2014, 09:31 PM
I am using 2013 q3 of the radgridview, and I need to validate my object in the row validating and cell validating event because some properties are required field.  In the row validating event, I'm explicitly clearing all the validationResults and appending 1 or more new validationresults to certain properties.  However, I found that Cell.Errors are not cleared when I clear validationResults, instead they are appeneded everytime I add a new validationresult in the row validating event.  How do I clear individual cell errors?


//rowvalidating event
if(conditionNotValid)
{
var r = param as Telerik.Windows.Controls.GridViewRowValidatingEventArgs;
r.IsValid = false;
r.ValidationResults.Clear();


foreach (.Infrastructure.ValidationError error in errors)
{
              r.ValidationResults.Add(new GridViewCellValidationResult() { ErrorMessage = error.ErrorMessage, PropertyName = error.PropertyName });
}

return;
}


//////////////////////
//Cell validating event
////////////////////// 
var c = param as Telerik.Windows.Controls.GridViewCellValidatingEventArgs;
c.Cell.Errors // errors does  not get cleared, but gets appended to this list !!!!!!!!!!














































2 Answers, 1 is accepted

Sort by
0
Gavin
Top achievements
Rank 1
answered on 23 Aug 2014, 11:20 AM
I found the ClearIfSet extension method for GridViewCell.  It is found in diagram.core.dll  
In the row validating event, I loop through each cell to clear it's ErrorsProperty now it looks like the errors no longer append itself.
0
Dimitrina
Telerik team
answered on 27 Aug 2014, 08:02 AM
Hello,

I can suggest you checking the "Validation errors not cleared" troubleshooting article. Does this help? 

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Gavin
Top achievements
Rank 1
Answers by
Gavin
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or