Same BO appear multiple instance in ChildBusinessObject collection


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have a form contains two business objects. I used ASPxGridView to bind to WebBBS which attach CHildBO. In Page_Load, I have code to set ChildBO.ParentBusinessObject = ParentBO if !IsPostback.



I am facing problem that, whenever I add new record to ASPxGridView, WebBBS.CreateShareAndAddBusinessObject() would be fired. In this method, it will clone the ChildBO; assign ChildBO.ParentBusinessObject to ClonedBO.ParentBusinessObject.



Whenever this happens, program try to access the ParentBO instance and add ClonedBO to its ChildBusinessObject collection. As all BOs are stored in Session, it cause existing ParentBO.ChildBusinessObjects retain and keep been added new ClonedBO.



It caused some error for that if I loop thru ParentBO.ChildBusienssObjects to do something.



Please advice.
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