Validating event fires twice for Color col

3 posts, 1 answers
  1. Thomas
    Thomas avatar
    15 posts
    Member since:
    Oct 2012

    Posted 21 Jul Link to this post

    Hi,

    I'm binding a grid to a collection where one of the properties is of type 'Color'.

    I want to validate the selected color, as only a subset of colors are allowed.

    The validating event fires twice after changing the value of 'Color col' cell. And hence my msg box is shown twice. Any way around this?

    private void StatusRadGridView_CellValidating(object sender, CellValidatingEventArgs e)
    {
        if (e.ActiveEditor != null && e.ActiveEditor is GridColorPickerEditor)
        {
            Color c = (Color)e.Value;
            if(!AllowedColors.Exists(o=>o.Name == c.Name))
            {
                e.Cancel = true;
                RadMessageBox.Show(errorMsg);
            }
        }
    }

  2. Answer
    Dess
    Admin
    Dess avatar
    1609 posts

    Posted 21 Jul Link to this post

    Hello Thomas,

    Thank you for writing.

    I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to use the GridViewDataRowInfo.ErrorText which is designed approach for indicating errors when validation fails.

    I hope this information helps. Should you have further questions I would be glad to help.


    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Thomas
    Thomas avatar
    15 posts
    Member since:
    Oct 2012

    Posted 21 Jul Link to this post

    Hi Dess,

    Thank you for the reply!

    I know about the errortext option - In this case I just wanted to clearly notify the user about the allowed colors instead of them having to get the information from the error tooltip info.

Back to Top