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
2013.2.611.1050
The problem will be fixed with the next internal build (Monday 23 Sep).
Sorry for the inconvenience caused.
Nedyalko Nikolov
Telerik
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 >>
There is no way to workaround this issue.
Regards,Nedyalko Nikolov
Telerik
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 >>
The latest internal build (version 2013.2.0923) has been released and is available for download under Your Account.
Regards,
Yordanka
Telerik
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 >>
Please, test with the latest internal build - version 2013.2.0930.
Regards,
Yordanka
Telerik
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 >>
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
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 >>
The problem is fixed with 2013.2.0930 internal build.
Regards,
Yordanka
Telerik
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 >>
Unless you're not telling me something about the build version ?
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();
}
}
Nedyalko Nikolov
Telerik
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 >>
Thank you
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.
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.
Yoan
Telerik
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 >>