I have an event defined to automaticlly add a new row when the user tabs out of the last cell. The problem is that this event fires wwhen the user enters the last cell rather than after leaving it with the tab key. My current logic is below - how should it be fixed?
grid.AfterPerformAction += new AfterUltraGridPerformActionEventHandler(OnGridPerformAction);
public static void OnGridPerformAction(object sender, AfterUltraGridPerformActionEventArgs e)
{
if (sender != null && sender is UltraGrid)
UltraGrid grid = (UltraGrid)sender;
if (e.UltraGridAction == UltraGridAction.NextCellByTab)
if ((grid.CurrentState & UltraGridState.CellLast) == UltraGridState.CellLast)
AddBlankGridRow(grid);
} }
}
Hello,
AfterPerformAction even occurs after the action was executed, which meant that using your code in this even adds new row if the last cell of the last row was reached. And this cause your issue. So you should move your code in BeforePerformAction even, please see attached sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Thanks, but when I tried to implement this logic, the grid blows up as soon as the code leave the PerformAction handler
The grid routines and the exception details are attached....