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

RadGridView - Can't Clear Out Row Validation Errors

3 Answers 338 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 16 Dec 2015, 06:05 PM

I am using the RadGridView control in an MVVM (Light) application. I added the following EventToCommandBehaviors to initiate row validation when leaving the selected row:

<telerik:EventBinding EventName="RowValidating" Command="{Binding ValidateCommand}" PassEventArgsToCommand="True"/>

<telerik:EventBinding EventName="RowEditEnded" Command="{Binding SaveCommand}" PassEventArgsToCommand="True"/>

 

Here's the method and helper method that gets called and works like it should to add the error:

        private void ExecuteValidate(GridViewRowValidatingEventArgs eventArgs)
        {
            var employee = eventArgs.Row.DataContext as Employee;
            if (employee?.RecId == (int)RecEnum.CertainState && employee.OtherRecId == null)
            {
                var validationResult = new GridViewCellValidationResult
                {
                    PropertyName = "ColumnUniqueName",
                    ErrorMessage = "Must enter a OtherRecId when RecId is set to CertainState"
                };
                eventArgs.ValidationResults.Add(validationResult);
            }

            if (eventArgs.ValidationResults.Count > 0)
            {
                eventArgs.IsValid = false;
            }
        }

And finally, following the instructions of removing the UserDefinedErrors, I add the following line in the RowEditEnded event:

            eventArgs.UserDefinedErrors.Clear();

 

If I fix the error, the row is saved, but the mouseover error message remains even though there are no errors. I followed your directions by adding the eventArgs.UserDefinedErrors.Clear(), but this didn't help.

Does anyone have any workarounds or must this bug be fixed?

Thanks for your help.

3 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 18 Dec 2015, 08:41 AM
Hello Jay,

I tried reproducing the issue you are experiencing but was not able to observe the undesired behavior. Would it be possible for you to provide me with a sample project that reflects your setup? I have created a sample from my end and I have attached it to my reply. You can review it and modify it so I can have a more detailed look and investigate the issue further.

Regards,
Stefan Nenchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 20 May 2016, 11:17 AM

I get the same problem with my own app and with the sample app here.

Can see the errors in UserDefinedErrors and clear them. 

Shows as 0 items.

Error's still show on grid tooltips.

Is there a fix yet please?

0
Dilyan Traykov
Telerik team
answered on 25 May 2016, 07:55 AM
Hello Ian,

The issue you're referring to has been fixed in the latest version of the controls. Could you please try updating to version 2016.2.503 and see if the problem persists?

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Jay
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Ian
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or