BindingSource problem with PrimaryKeyIsAutoIncremented and PrimaryKeyIsUpdatable


Author
Message
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Hi,

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

Attachments
WindowsApplication1.zip (107 views, 720.00 KB)
Grid1.png (136 views, 35.00 KB)
Grid2.png (134 views, 37.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search