I have an ultragrid which is bound to a strongly typed class (I think that is the right jargon anyway). Basically, a class which hold data from the database after retreiving it.
One way that I am allowing data entry into this grid, is for the user to double-click on a blank (empty) row, and have a new form (detail/card view), to which I pass the object (class to which the grid is bound). In the new form (running modally), the user can enter details. When they press "OK", the data is saved to the database.
When I come back to the original form, the data is already there (as the class was passed by reference I think, so it was changed in both places at once). The problem is, that the grid did not register it as an insert. It still beleives the empty row that I double clicked on is still an empty row, so it wont show another empty row (as in, it still has the asterix on this row, indicating that it thinks it is empty).
How do I manually tell the grid that this row has been saved to the database, and to act accordingly?
Thanks.
Thanks - its working now.
I might have been doing .ActiveRow.Refresh rather than Rows.Refresh (or it could have been the AddRowModifiedByUser bit).
In any case, thanks.
Hi,
Try something like this:
this.ultraGrid1.Rows.AddRowModifiedByUser = true;
This tells the grid that the TemplateAddRow was modified by the user so it will act as though the user typed something into a cell of the TemplateAddRow.
Also... you might want to look into using the RowEditTemplate feature of the grid. This feature allows you to create a form in which the user can edit a single row. It sounds like you are basically re-implementing this yourself so the built-in feature might save you some time.
I think it is the TemplateAddRow. I have tried calling update on the row, to no avail.
Is it the TemplateAddRow that you're allowing the user to double-click? You could try calling Update on the row to ensure that it's been committed to your data source, though you would of course have to make sure that you don't try to re-commit the data to your DB.
-Matt