First of all...this is our first project using CSLA. We are developing Windows Forms project in C# VS 2005. Now, for the simple tables we are using BusinessListBase bound to a GridView through BindingContext. Lets say there are two fields in a table. For the first field (property), we generate the ID by incrementing 1 (as seen in ProjectTracker sample). The next field will be entered by user.
Now, lets say the user is entering records in the grid. When user presses enter in the second field, the focus moves to the last line of grid, and a new ID is generated. But the user does not want to add more records - so if he presses save, the errorprovider says that you cant have blank 'field2'.
How to solve the issue, or how can I check that the last data only has ID generated but no editing done by user - so then I can discard the last record while saving.
I will have a series of questions coming...
I would look at the DataError event of the grid. But, actually my problem was not that - the user have done anything wrong. After pressing <ENTER> at the last column of the grid, the cursor moves to the next line of the grid - and we have generated a new ID for the primary key property. The user just wants to save his own record. How can I undo the last generated record from the grid and also from the businesslistbase class.
One quick question - does the gridview columns have UpdateMode property? For the grid columns I also want OnPropertyChanged instead of OnValidate to be set...where do I do that?
Copyright (c) Marimer LLC