c# - Exception "The specified entity is not contained in this EntitySet." but Entity is contained -
c# - Exception "The specified entity is not contained in this EntitySet." but Entity is contained -
i have exception "the specified entity not contained in entityset.
" . when datasource, see entity in there.
here code :
class1 item = (class1)dg.selecteditem; if (item!= null) { class2 item2= new class2(); item2.att1= item.att1; item2.att2= item.att2; item2.att3= item.att3; mydatasource.dataview.remove(item2); }
i want delete object of datasource, have attributes of selected item in datagrid.
when watch on datasource, item2 appears, why can't delete datasource? same class, same attribute. don't understand.
i found this, , works :
if (item!= null) { class2 mypiece = mydatasource.dataview.oftype<class2>().where(ores => ores.att1 == item.att1).firstordefault() ; mydatasource.dataview.remove(mypiece); }
basically need delete same item, creating new item giving issue.
should this
class1 item = (class1)dg.selecteditem; if (item!= null) { mydatasource.dataview.remove(item ); }
c# silverlight silverlight-4.0
Comments
Post a Comment