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
80
How to rollback changes with a bound data source
posted

Here is the issue:

I have a grid which has a dropdown column defined with a valuelist. When the user adds a new row to the grid, and selects a value from the dropdown, I'd like to run a check to see if the value selected, is selected in a previous row. Just looking to throw a message, and then restore the value that was there before the user selected from the dropdown.

The routine to determine if the user selected something already selected is the easy part. I'm having difficulty  determining what events to place the check in order to roll back the users selection. I've tried CellChange, AfterCloseup, etc. I think the difficulty is not undertanding what sequence the cell and row events get fire, and when exactly the grid updates the datasource. Can you help? Can you at least provide a description of when  the bound datasource is updated when leaving the cell? is there a way to update the data source when changing the value in the dropdown?

  • 469350
    Offline posted

    I think you will probably want to use BeforeRowUpdate or BeforeCellUpdate for this.

    When the data source gets updated depends on the UpdateMode property of the grid. By default, I think it's set to OnRowChangeOrLostFocus.