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
130
UltraGrid right sequence events fired fo input validation
posted

Hi, I'm new to UltraGrid, and need your help.

I'm trying to solve this by myself but with no success.

Using VB, or C#, no problem, what is the right sequence that I should check the events, in order to verify the user input?

I want the user to be able to insert new rows (I have a button for that), delete (also have a button) and update (simply start writing). But I must verify if all the cells have good values before I save it to the DataTable, and after that to the database.

I would like to be able to prevent the user form clicking outside the grid, during an Insert (new row) o update.

I appreciate your help. I don't want you to make my work, just point out the guidelines and if possible where I can find some examples. I already searched everywhere, but didn't find much help.

Hope you can help me on this, because I already spent more then 3 days trying it out with no success.

Thanks in advance. Best regards.

  • 469350
    Offline posted

    Hi,

    There are a number of ways you can handle validation in the grid. If you want to validate the entire row at once, then the best event to use would be BeforeRowUpdate. This event will fire both for new rows and existing rows any time the user tries to commit the changes to that row. You can tell the different by checking the IsAddRow property on the grid's ActiveRow. If it's true, it's a new row, otherwise, it's an existing row.

    The event gives you the ability to cancel the changes and there's a property on the grid called BeforeRowUpdateCancelAction which gives you some options for what happens when the event is cancelled.

    You could also choose to validate data on a cell-by-cell basis. You could use BeforeCellUpdate or BeforeExitEditMode for this, depending on your needs. You can also apply some validation rules to the grid using the UltraWinValidator component.