if (<condition 1>)
{
errorMsg = "This value must exists in that table";
isValid = false;
} else if (<condition 2>)
errorMsg = "This value is duplicated";
isValid = false;
}
// and so on
return (isValid, errorMsg);
<RadzenCustomValidator Component="Email" Validator="@(() => ValidateNewEmail(model.Email))" Text=@MessageVariable />
You can try assigning Text property of the validator content to a string variable and assign value to that variable based on your condition.
I'm confused about how the variable scoping works for this "@MessageVariable" example. The function "ValidateNewEmail()" somehow has to set an external variable that's in the scope of the Razor markup, but how to do that baffles me. I'd like to request clarification. Thank You.