data binding - Silverlight 4 Add New Item To DomainDataSource -


i have simple datagrid listing addresses , child window user can edit/add new. on main form datagrid have button "insert new address" should load child window empty address object. not let me add record. doing wrong? current code follows:

    dim address new address     dim frmaddressobj new frmaddress      if frmaddressobj.addressdomaindatasource.dataview.canadd = false         frmaddressobj.addressdomaindatasource.load()     end if     frmaddressobj.addressdomaindatasource.dataview.add(address) 

address address object. frmaddress child window form. addressdomaindatasource same datasource use in datagrid use in child. canadd false , got told try loading before adding not appear have helped. when reaches add method returns exception of 'add' not supported icollectionview. appreciated. thanks

the dataview field should thought of read-only collection. simplest general usage of domaindatasource datagrid goes this:

(mydatasource.domaincontext mydomaincontext).my_entitys.remove(dgorders.selecteditem order); (mydatasource.domaincontext mydomaincontext).submitchanges(); 

it similar insert, use

my_entitys.add(mynewentityinstance);  

instead of

my_entitys.remove(entitytoremove); 

and updates call

(mydatasource.domaincontext mydomaincontext).submitchanges(); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -