Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1834
How to validate cell when saving changes from Toolbar button (and focus not lost from cell)?
posted
Hi,

I've got an UltraGrid that allows users to edit a Name field. To require a name, I have the Nullable setting for that column to Disallowed. This works fine normally, but the Save button is in a toolbar ribbon, so it doesn't actually pull focus away from the cell when clicked (thus allowing an empty string in the column that throws an error on UpdateData()).

I've tried doing a PerformAction(ExitEditMode) at the start of the Save code, and it correctly fires the validation, but then proceeds with the rest of the Save code.

Is there an easy way for me to validate, cancel the Save, and retain focus on the bad cell?

Thanks,
J
Parents
  • 469350
    Offline posted

    Hi J,

    Doesn't PerformAction return a boolean which indicates if the action was successful? If so, you could just skip the rest of the code if the PerformAction fails. 

    If I am wrong and there is no such return value, then you could check to see if the grid is still in edit mode after you call PerformAction. If so, you know the PerformAction failed and again, you can skip the rest of the code. 

Reply Children
No Data