Problem removing the validation

20 posts, 0 answers
  1. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 09 Sep 2013 Link to this post

    Hi,
    We are using Telerik Controls for Silverlight 5 (Version: 2013.2.625.1050).
    We need to validate the uniqueness of one field (duplication not allowed).

    We are checking this in the RowValdiating event as below and adding the validation message.

    private void grdEmployees_RowValidating(object sender, GridViewRowValidatingEventArgs e)
            {
                bool HasError = false;
                foreach (var item in grdEmployees.Items)
                {
                    if (e.Row.Item != item)
                    {
                        if (((EmployeeDTO)e.Row.Item).EmpName.ToLower() == ((EmployeeDTO)item).EmpName.ToLower())
                        {
                            HasError = true;
                            GridViewCellValidationResult validation = new GridViewCellValidationResult();
                            validation.PropertyName = "EmpName";
                            validation.ErrorMessage = "Name should be unique.";                       
                            e.ValidationResults.Add(validation);
                            return;
                        }
                    }
                }
                if (!HasError)
                {
                    if (e.ValidationResults.Count > 0)
                    {
                        e.ValidationResults.Clear();
                    }
                }
            }


    Its properly adding the validation. But the problem is, the validation is not going off after fixing the error.
    How can I remove the error once after fixing the data.

    Please help.

    Regards,
    SivaPrasad.B
  2. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 17 Sep 2013 Link to this post

    I have the exact same problem here.  Hope for a solution soon !
    2013.2.611.1050
  3. DevCraft banner
  4. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 17 Sep 2013 Link to this post

    Hello,

    The problem will be fixed with the next internal build (Monday 23 Sep).
    Sorry for the inconvenience caused.

    Regards,
    Nedyalko Nikolov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  5. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 17 Sep 2013 Link to this post

    Good news.  Any possible work around ?
  6. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 17 Sep 2013 Link to this post

    Hi,

    There is no way to workaround this issue.

    Regards,
    Nedyalko Nikolov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  7. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 17 Sep 2013 Link to this post

    Ok all right.  As I can see, it's only a visual problem because if I refresh everything is all right.
  8. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 24 Sep 2013 Link to this post

    Is the build that fix this is ready ?
  9. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 25 Sep 2013 Link to this post

    Hi,

    The latest internal build (version 2013.2.0923) has been released and is available for download under Your Account.
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 26 Sep 2013 Link to this post

    I'm trying the new internal build and yet it's not working.  For instance after I hit ESC to cancel my editing since the row isn't valid, it should get out of editing and clear the validation error but I'm left on the grid not editing and I still have the row in error with the message huh ?
  11. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 26 Sep 2013 Link to this post

    When I say cancel editing I mean cancelling the editing of an existing row.  For instance if I edit an existing row and provoke an error then if I cancel my edit with ESC, it cancel all right, I'm back in the grid but with the line in red with the STOP sign in the indicator along with the error message.  Since I cancelled the editing why do I still have the error like that ?
  12. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 01 Oct 2013 Link to this post

    Hello Marc,

    Please, test with the latest internal build - version 2013.2.0930.
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  13. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 01 Oct 2013 Link to this post

    This is the same build I just downloaded.
  14. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 01 Oct 2013 Link to this post

    Hi Marc,

    Could you confirm the problem occurs with 2013.2.0930 internal build? If so, please open a support ticket and attach a sample runnable project which reproduces the problem. We will debug it on our side and will assist you further.
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  15. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 02 Oct 2013 Link to this post

    Hi Marc,

    The problem is fixed with 2013.2.0930 internal build.
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  16. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 02 Oct 2013 Link to this post

    Absolutely not.  With this build, yes exactly the same one, when we do ESC to cancel the faulty edit, the line remins red with the message and we can go on another line and do things.  This isn't right at all.  I've sent the Repro and explained exactly what to do.

    Unless you're not telling me something about the build version ?
  17. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 03 Oct 2013 Link to this post

    Hello,

    The problem comes from the fact that you are validating edit on RowValidating event and add some user errors. Unfortunately for the time being RadGridView does not provide an API to clear these user defined errors, so currently the only way to workaround this is to Rebind() RadGridView (this will create new rows which will not have such errors). With the next internal build (and also with the upcoming official release) we will introduce a new property inside RowEditEnded event args named "UserDefinedErrors" - which will represent a generic IList<string> with all user errors for that row. You will be able to handle RowEditEnded event and clear these errors (which will update valid state). Your code should be similar to the following:

    private void rgvTest_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
            {
                if (e.EditAction == GridViewEditAction.Cancel)
                {
                    //(sender as GridViewDataControl).Rebind();
                    e.UserDefinedErrors.Clear();
                }
            }

    Regards,
    Nedyalko Nikolov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  18. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 03 Oct 2013 Link to this post

    The Rebind works just fine right now.  I'm very pleased to have a workaround until the new property comes out.
    Thank you
  19. Jeff
    Jeff avatar
    39 posts
    Member since:
    Jun 2013

    Posted 25 Oct 2013 Link to this post

    See *Update* section at bottom...

    Is the newly described method for clearing validation errors working for anyone?  I'm using version 2013.3.1016.40 an my RowEditEndedEvent now contains the following code:

    if (e.EditAction == GridViewEditAction.Cancel)
    {
        e.UserDefinedErrors.Clear();
        //(sender as GridViewDataControl).Rebind();
        return;
    }

    When I get to the above code, the UserDefinedErrors member has content, it definitely gets cleared, and I'm allowed to move to another row, but the previous row is still marked as invalid.

    The Rebind() trick still works (commented out above), but clearing the new property seems to have no effect.  Guh...  Am I missing something?

    Jeff

    ******** Update ********

    In the app where this is still problematic, I have the following property set on my RadGridView:

    ValidatesOnDataErrors="InEditMode"

    As long as I use the above setting, clearing the "UserDefinedErrors" property does not clear the invalid row rendering - as explained above.
  20. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 30 Oct 2013 Link to this post

    Hello Jeff,

    We are aware of this issue. Unfortunately, we are not able to find the cause of the problem and we will continue to investigate it. As a workaround you can remove the ValidatesOnDataErrors property.

    Please excuse us for the inconvenience caused.

    Regards,
    Yoan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner