DataGrid - Validator using another property of the EditItem #1638
Unanswered
paulosdfigueiredo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Yes, that's possible. Validator is just a function that you can write by yourself. If you want to check for your current Id, the best solution is to get it from the selected row item with binding: And then have a validator, like this: public void CheckEMail( ValidatorEventArgs validationArgs )
{
// check selectedEmployee.Id here
ValidationRule.IsEmail( validationArgs );
if ( validationArgs.Status == ValidationStatus.Error )
{
validationArgs.ErrorText = "EMail has to be valid email";
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Imagine i want to edit one Item and validate if the new name already exists on server. I need to know the Id of the current item, so i can ignore it when comparing.
Is there any way to use other properties from the current item in the validator? Or whats the best way to access the current EditItem?
Beta Was this translation helpful? Give feedback.
All reactions