This is a migrated thread and some comments may be shown as answers.

RadGrid w/ ADO.NET Entity Framework & Dispose/Using

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kpat154
Top achievements
Rank 1
kpat154 asked on 10 Dec 2008, 07:04 PM
What is the proper way to bind data to RadGrid via the ADO.NET Entity Framework?

For example, something like...

protected void radGrid_NeedDataSource( object source, GridNeedDataSourceEventArgs e ) 
    using( EntityContext c = new EntityContext() ) 
    { 
        var query = from x in context.Topics 
                    select new 
                    { 
                        field = x.foo 
                    } 
 
        radGrid.DataSource = query; 
    } 

... will fail because the context has been disposed before the grid actually evaluates the LINQ query.

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Dec 2008, 07:53 AM
Hello kpat154,

You can use EntityDataSource instead.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
kpat154
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or