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
2945
Setting Selected row from AfterRowUpdate event
posted

I wonder if someone can help me with something that's had me banging my head against the wall for a good while.

In my grid, if the user modifies a row and tabs away, I may need to merge that row with another row.  So in grid_AfterRowUpdate event, I delete the selected row, and want to select the new row it was merged with.

I can set this fine within this event.  But because AfterRowUpdate fires before the tab away from the cell action completes, the grid always subsequently sets my selection onto the row after the original one I deleted.  I can't figure out a way to Cancel this behaviour and persist my new selection.

Any assistance greatly appreciated.

Thanks. 

Parents
  • 34810
    Verified Answer
    Offline posted

    Hello Campbell,

    I have been investigating into the behavior you are looking to achieve, and I would like you to take a look at the sample project I am attaching. In the sample project, to simulate your “merging” I have multiple rows in the grid with the same ID, and when one is updated, the other one will be selected.

    This was a bit tricky to implement, but rather than using the AfterRowUpdate event, I would recommend using BeforeRowUpdate for this, as this event is cancellable and can prevent the default tab activity if you cancel it. With that said, you can unhook the BeforeRowUpdate event, call the Update() method on the Row to force-update it, and then re-hook the event after moving your selection.

    This is demonstrated in the sample project attached. I hope it helps you.

    Please let me know if you have any other questions or concerns on this matter.

    UltraGridSelectionCase.zip

Reply Children
No Data