listobject delete is not deleting the child object

listobject delete is not deleting the child object

Old forum URL: forums.lhotka.net/forums/t/9344.aspx


kam_csla posted on Monday, August 09, 2010

i already posted earlier regarding this. here is the conversation..

[Serializable()] public class AList : BusinessListBase<AList, A>

 {

public AList()

{

MarkAsChild();

}

}

[Serializable()] public class ABusinessBase<A>

{

 }

aspx.cs

 objectAInstantiatedList[index].Delete();

GrdTest.DataSource = objectAInstantiatedList;

GrdTest.DataBind();

The objectAInstantiatedList has 3 records and once i delete the item.. the objectAInstantiatedList is not updating the count to 2 and the grid still showing 3 records. Please suggest where am going wrong..

reply1

To delete a child object in a list, you call Remove on the list, not delete on the child.

Rocky

my reply

Thanks for reply Lhotka.. But if i use remove then it throws error saying "use delete instead" and thats the reason i used delete.

sorry for posting again.. am really not sure of what am missing in the abov code..

objectAInstantiatedList.RemoveAt(index);

GrdTest.DataSource = objectAInstantiatedList;

GrdTest.DataBind();

Copyright (c) Marimer LLC