after updating entities in a different form,I want to reload the data in the grid but it doesn't seem to update.I use:
private void LoadData()
{
siparisBindingSource.DataSource = db.Siparis.Include("Kazan").ToList();
}
To load data.After openning a dialog:
private void değiştirToolStripMenuItem_Click(object sender, EventArgs e)
{
Siparis siparis = gridView1.GetFocusedRow() as Siparis;
if (siparis != null)
{
FormSiparisAddEdit siparisAddEdit = new FormSiparisAddEdit {isedit = true, sipID = siparis.ID};
siparisAddEdit.ShowDialog();
LoadData();
}
}
and changing the entities,i try reloading using this method,but the contents stay the same unless i close and reopen the form.What I am i missing here?
Cheers for the answer,but i have another problem now,since i have made the db short lived,i can not get the detail data,i tried using :
private void gridView1_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e)
{
Siparis siparis = (Siparis)gridView1.GetRow(e.RowHandle);
using (var db = new Tank_Analizor_DBEntities())
{
db.Siparis.Attach(siparis);
e.ChildList = new BindingSource(siparis, "Kazan");
}
}
But i get
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
Error,if i debug it,the child list gets the detail data...