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);
} }
}
Have you considered just setting AllowAddNew to AllowAddNew.TemplateOnBottom? In this mode, modifying the template add row makes it become an add row and a new template add row shows up under it so the user can just tab into it and start typing.