Hi
I would like to suppress the new template row add to the grid when the existing template row is not filled with valid data. Which event should I cancel to suppress the new template row at the bottom?
Also, I see that RowEditTemplateRequested event is not fired at all.
Is this order of firing these events?
1) RowEditTemplateRequested
2) IntializeTemplateAddRow,
3) BeforeRowEditTemplateDisplayed
Thanks
Perhaps you need to do the same check in the Validating event of the grid, then?
Hi Mike,
I'm canceling the BeforeRowDeactivate event when the row is not valid and that works fine when moving away to another row, but this fails when I click outside the Grid and another control gets focused. It seems that cancelling the BeforeRowDeactivate event does not prevent the grid from losing focus. I would like to prevent the user from leaving the row until they either fix the problem or cancel the update by pressing Esc.
RowEditTemplate is not the same as a TemplateAddRow. These are two totally different areas of functionality.
I don't think it's possible to cancel the new TemplateAddRow once you start editing an existing row. What happens is that once you enter a TemplateAddRow and begin to edit a cell, the TemplateAddRow becomes an Add Row and it no longer a TemplateAddRow. So a new TemplateAddRow has to be shown. Otherwise, the AllowAddNew setting would no longer be valid since there would be no template add row.
So it seems to me that you have a couple of options.
1) You could use BeforeRowUpdate and/or BeforeRowDeactivate to prevent the user from leaving the Add Row once they start editing until the row is completely filled in.
2) You could set AllowAddNew to No and then add rows to the grid in code or via the AddNewButtons so that you have full control over when the new rows are created.