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

Problem removing the validation

19 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 09 Sep 2013, 01:43 PM
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

19 Answers, 1 is accepted

Sort by
0
Marc Roussel
Top achievements
Rank 2
answered on 17 Sep 2013, 11:04 AM
I have the exact same problem here.  Hope for a solution soon !
2013.2.611.1050
0
Nedyalko Nikolov
Telerik team
answered on 17 Sep 2013, 11:11 AM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 17 Sep 2013, 11:12 AM
Good news.  Any possible work around ?
0
Nedyalko Nikolov
Telerik team
answered on 17 Sep 2013, 11:15 AM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 17 Sep 2013, 11:32 AM
Ok all right.  As I can see, it's only a visual problem because if I refresh everything is all right.
0
Marc Roussel
Top achievements
Rank 2
answered on 24 Sep 2013, 04:51 PM
Is the build that fix this is ready ?
0
Yordanka
Telerik team
answered on 25 Sep 2013, 05:19 AM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Sep 2013, 01:09 PM
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 ?
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Sep 2013, 01:33 PM
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 ?
0
Yordanka
Telerik team
answered on 01 Oct 2013, 01:02 PM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 01 Oct 2013, 01:06 PM
This is the same build I just downloaded.
0
Yordanka
Telerik team
answered on 01 Oct 2013, 01:14 PM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 01 Oct 2013, 02:00 PM
0
Yordanka
Telerik team
answered on 02 Oct 2013, 06:28 AM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 02 Oct 2013, 10:21 AM
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 ?
0
Nedyalko Nikolov
Telerik team
answered on 03 Oct 2013, 10:43 AM
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 >>
0
Marc Roussel
Top achievements
Rank 2
answered on 03 Oct 2013, 10:47 AM
The Rebind works just fine right now.  I'm very pleased to have a workaround until the new property comes out.
Thank you
0
Jeff
Top achievements
Rank 1
answered on 25 Oct 2013, 03:12 PM
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.
0
Yoan
Telerik team
answered on 30 Oct 2013, 01:49 PM
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 >>
Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Answers by
Marc Roussel
Top achievements
Rank 2
Nedyalko Nikolov
Telerik team
Yordanka
Telerik team
Jeff
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or