RadGridView - Can't Clear Out Row Validation Errors

4 posts, 0 answers
  1. Jay
    Jay avatar
    1 posts
    Member since:
    Feb 2015

    Posted 16 Dec 2015 Link to this post

    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.

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    281 posts

    Posted 18 Dec 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ian
    Ian avatar
    4 posts
    Member since:
    Nov 2015

    Posted 20 May in reply to Stefan Nenchev Link to this post

    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?

  5. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 25 May Link to this post

    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.
Back to Top