Refresh combobox after insert a new record EF 4


i have these lines in form_load:

            productscombobox.displaymember = "productname";              productscombobox.valuemember = "productid";              productscombobox.datasource = db.context.products;

when call savechanges on ef, combobox reglect new list.

i tried re-assign context data source of combo box, giving null , assiging agaibn data source, nothing happens.

i know data base saves changes, because when close , re open form, can see new items.

 

noam b.



not forget vote answer/helpful, please. encourages you...

ok, if encounters problem, did initiate database object contained context (ef) after deleting or creating item in db. then, re-assign displaymemeber, valuemember , datasource.

that forced program load again tables, time updated.

but still wierd thing first 1 notice problem.

 

noam b.



not forget vote answer/helpful, please. encourages you...



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user