How can i return IEnumarable data from function in GridView with Entity FrameWork?
Posted
by programmerist
on Stack Overflow
See other posts from Stack Overflow
or by programmerist
Published on 2010-04-04T13:09:56Z
Indexed on
2010/04/04
13:13 UTC
Read the original article
Hit count: 327
protected IEnumerable GetPersonalsData()
{
// List personel;
using (FirmaEntities firmactx = new FirmaEntities())
{
var personeldata = (from p in firmactx.Personals select new { p.ID, p.Name, p.SurName });
return personeldata.AsEnumerable();
}
}
i wan to send GetPersonelData() into GridView DataSource. Like That:
gwPersonel.DataSource = GetPersonelData();
gwPersonel.DataBind();
it monitored to me on : gwPersonel.DataBind(); this error:
"The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."
© Stack Overflow or respective owner