I'm using an Add Row at the bottom of an UltraGrid. After the user has filled out the Add Row and hit the enter key, I need to examine a cell in the newly added row in order to know which count to increment in a related row of another grid. The AfterRowInsert would seem to be the likely event to use, but it fires the instant the user starts typing into the AddRow. What event signals the completion of the row insertion? Also I have two user controls in this grid which accept latitude and longitude. As soon as the user completes the first user control (latitude) and attempts to move to any other cell in the AddRow, the AddRow contents immediately populate a new row in the grid instead of allowing the user to finish entering data in the remaining cells of the AddRow. How can I prevent that until the user has completed the AddRow?
Any help would be appreciated,
Thanks,
George
Hi George,
holbert said:What event signals the completion of the row insertion?
Use AfterRowUpdate and check row.IsAddRow to distinguish between a new row and an existing row.
holbert said:Also I have two user controls in this grid which accept latitude and longitude. As soon as the user completes the first user control (latitude) and attempts to move to any other cell in the AddRow, the AddRow contents immediately populate a new row in the grid instead of allowing the user to finish entering data in the remaining cells of the AddRow. How can I prevent that until the user has completed the AddRow?
Once you click on or otherwise put focus into the TemplateAddRow, it ceases to be a TemplateAddRow and becomes an AddRow. At this point, the row exists in the data source as an AddRow.
Once you start typing or change any value in any cell, the grid automatically creates a new TemplateAddRow. This allows the user to keep tabbing through the cells of the AddRow right into the new TemplateAddRow and create several new rows in sequence.
There's no way to stop the new TemplateAddRow from appearing.
One thing you could do is - don't use the TemplateAddRow setting for AllowAddNew. You could set AllowAddNew to None and show the AddNewBox instead. This would force the user to push a button to create a new add row instead of always having one visible.