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
140
Moving to a cell
posted

Sometimes i want to move to a cell in the same activated row. For example if i am in a cell getting a product code i want:

 1.- Move to another cell if the code is valid.

 2.- Remain in the same cell if no the code is wrong.

I ussually write the code in BeforeCellDeactivate, look for the product, display the name in one cell, the price in another and so on. Then

i want to move to another cell o remain until a valid code is entered.

Wich is the best way to do this and is BeforeCellDeactivated the correct place to validate this product code?

 

Parents
  • 469350
    Verified Answer
    Offline posted

    The easiest way to move focus to a new cell is to simply set the ActiveCell property on the grid. 

    Which event you would use depends on when you want to move to the other cell. BeforeCellDeactivate will fire when the user tried to leave the current cell. So this doesn't seem like such a good idea to me, because if the user attempts to click from one cell onto a completely different cell in another row, then you will end up setting focus to a cell other than the one they clicked on and this might be pretty confusing to a user.

    So the real question is, what criteria do you want to use to decide when to change the focus? 

Reply Children