return custom error message after cancel a server side event (C#)
return custom error message after cancel a server side event (C#)
On the server side I check if a record can be removed. if not I'd like to return a custom error message to the user to explain why it can't be deleted:
editor.PreRemove += (sender, e) =>
{
if (CannotBeDeleted(...))
{
e.Cancel = true;
return;
}
}
I'm wondering where I can add the message like "This record is a special one that you have to keep".
Thanks!
Shumin
Answers
Hi Shumin,
Use a validator rather than event handler if you want to return a message to the client-side.
As the docs mention:
That said, there probably should be a mechnaisim for feedback rather than just nothing happening. I will look at that in future, but for now, use a validator.
Allan
Got it. Thanks!