Hello:
I am using WinGrid .Net v2.0.20062.60510.
The grid displays the data from a table where FirstName is mandatory.
I do a dsDataSet.Update on the _AfterRowUpdate event.
While I add data to the phantom row at the bottom of the grid, and supply thr required data, when I click on an existing row, the databse is updated with no errors.
However, when I click on the new Phantom Row, I get an error message "First Name is mandatory". But the row does get updated in the table.
Can somebody tell my what I am doing wrong?
I assume that by "the phantom row" you are referring to the TemplateAddRow.
As soon as you click on the TemplateAddRow, it becomes an AddRow and a new AddRow is added to the grid's DataSource. So if you call Update on your DataSet at this point, you are trying to save 2 rows, not just one.
I don't see any way around this. By placing the focus in the AddNewRow, you are essentially in the middle of an edit of a new row and that row is part of the data source, so it will try to get saved.
It's probably not a good idea to try to update the back end after each individual row update. The DotNet framework is set up to do updates in batches, not one at a time.
Mike:
Thanks for your reply.
The user wants an implicit save every time the row is changed.
Is there any event that Wingrid supports that enables me to save data on BeforeRow Change event?
If there's one such, I can see if there are changes to the dataset and if so, issue an update.
Venki