C1FlexGrid ValidateEdit method does not prevent clicking on ToolStripButton

Posted by: peterc on 23 January 2018, 5:11 am EST

    • Post Options:
    • Link

    Posted 23 January 2018, 5:11 am EST

    Hi,

    I’ve added the ValidateEdit method to a FlexGrid.

    This method validates the value entered into a cell before the value is changed and disregard the change if the user entered invalid value.

    When the user tries to leave a cell with invalid value he is not able to do so until he changes the value to a valid one.

    This behavior works correctly for me except for when the user click on a ToolStripButton (System.Windows.Forms.ToolStripButton).

    When the user click on a ToolStripButton he escape the validation.

    How do i prevent him from escaping the validation for the ToolStripButton as well ?


    (The FlexGrid and the ToolStrip containing the ToolStripButton are children of the same control.)

  • Posted 24 January 2018, 2:24 am EST

    Hi Peter!

    Please note, ValidateEdit event gets fired before the cell leaves edit mode. So, in your scenario, what you can try is :

    • Set value of a boolean variable to true in SetUpEditor event (Indicating that the cell has entered edit mode, and validation is still pending).
    • Check if this variable is true in ItemClicked event of ToolStrip then validation can be performed in this event itself.

    Now, it depends on your requirements if you need to validate the cell content in ValidateEdit event as well.

    In case, you face any issue then I would need some more details about the use case.

    Best regards,

    Meenakshi

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels