When a business object’s PrimaryKeyIsAutoIncremented = False and PrimaryKeyIsUpdatable = True, it appears to upset current row binding through a bindingsource when a new record is added. The attached sample project hopefully will show this.
Run the application against the StrataFrameSample database. When the form runs, it will show an Infragistics UltraGrid bound to the sample products through a bindingsource. PrimaryKeyIsAutoIncremented and PrimaryKeyIsUpdatable are set to the defaults of True and False respectively. Click on the New button and a new record is added to the bottom of the grid and it is the active row. Screenshot “Grid1” shows this. So far so good.
Stop the application and change PrimaryKeyIsAutoIncremented to False and PrimaryKeyIsUpdatable to True and re-run. This will enable code in the business objects SetDefaultValues() to assign a manual ID value. Now click the New button and two things happen:-
1. The first record remains the current row – see screenshot “Grid2”.
2. The new record is added to the end of the grid but it is not the current row.
Basically, the change from an auto generated key to a manual key has resulted in the new record not being made the current row in the grid. Have I missed something?
Thanks in advance,
Aaron
if
That will get you the behavior that you are looking for.
In other word, should I add that code to my base BO if using PrimaryKeyIsUpdatable?