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
975
Problem activating add row
posted

Hello;

 I'm using the _BeforeRowUpdate grid event to validate data the user has entered and if it's found to be invalid, I show a messagebox indicating the invalid data problem and activate the appropriate row and cell and do a PerformAction:

e.Row.Activate();

theCell.Activate();

this.myGird.PerformAction(UltraGridAction.EnterEditMode);

 

This works fine unless the user is working in the add row, in which case the row that ends up being activated is the last row of the grid. I've spent a bit of time tracing code, adding debug statements, trying eveything I can think of, but I can't figure this out.

 

Thanks,

 

Bill

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Bill,

    I'm surprised this code works for any row. You are essentially activating the same row that is already active. I think what you need to do is set the BeforeRowUpdateCancelAction property on the grid. Then just set e.Cancel inside BeforeRowActivate. This should allow you to prevent the row from losing focus. You will still want to activate the cell and enter edit mode, I think. 

Children
No Data