I'm using a subclass of binding navigator in my data entry form, everything is working fine but there is one very strange problem.
When I retrieve a po and without saving it when i try to add a new record then it is showing 2 records in the binding navigator. If I try to navigate on the previous record then it is not showing any values.
This is the code in my AddPo method
_PoMain =
PoMain.NewPoMain(); //Creates a new Po Objecte.NewObject = (
object) _PoMain; // setting new object to Newly created BO// Then I set the binding source
This is the code in my GetPo method.
_PoMain =
PoMain.GetPoMain(PoNo); // Gets specified Record from Database// Then I set the binding source
_PoMain variable is main variable defined at the class level and it is only having one record at a time. I'm not able to understand how two records are being added in Binding Source.
Dear Rocky,
Thanks for your reply.
Kindly note that I'm using version 2.14.
I will try and download the newer version (3.0) and test it out. Kindly note that for this application I'm not using WPF and all of the forms are WinForms 2.0.
Kindly note that I downloaded version 3.01 and tested the program.
The Po form which I reported before is using SafeDataRowReader as child and grandchildren objects are involved. That is showing the same problem like before.
But in my other form i.e. Order Entry, it is throwing following exception
"Edit Level mismatch in CopyState"
I'm using the same code to populate order object also and I'm also not using the Undo mechanism provided by CSLA. Instead I'm calling BindingSource.CancelEdit when the cancel button is clicked.
Kindly advise your comments.
Make sure to read this thread
http://forums.lhotka.net/forums/thread/16971.aspx
While 3.0.2 (this is the version for you) addresses some CSLA bugs around eventing and data binding in Windows Forms, it is up to you to make sure your UI code is correct.
Please note that (to my knowledge) only the UI code in PTWin 3.0.2 works entirely as expected. The data binding code in the UI must be done just right, or you will get undesired results.
I switched to the 3.02 test version and now the error ""Edit Level mismatch in CopyState" is gone but the problem remain as it is.
I also noticed that when I click on the Add Button continuosly without saving the object then for the first 2 records, it is adding 2 records in binding source but after that it remains on 2 records only.
I'm using the Int Primary Key and using the LastID static field to generate a temp key and I can see that it goes on changing ID field on each click of Add button without adding any more records after 2.
Copyright (c) Marimer LLC