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

data binding radgrid using linq and a stored procedure

1 Answer 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aviram
Top achievements
Rank 1
Aviram asked on 23 Aug 2010, 12:59 PM
Hi,

I have a RadGrid control which I want to bind to a linq data source which uses a stored procedure.
The data bind should happen in the code behind and not on the aspx page cause I use my own filter to search on grid results.
I would appreciate a code sample.

Thanks,
Aviram 

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 24 Aug 2010, 04:33 PM
Hello Aviram,

Generally speaking there should be no substantial difference between usage of store procedures, mapped to the DataContext or a Table<> to feed data to RadGrid control. For example:

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    //GetAllProducts is a store procedure mapped to the dataContext
    ((RadGrid)source).DataSource = _db.GetAllProducts();
}

Please refer to this online demo for a simple implementation of manual CRUD operation using RadGrid and LinqToSql.

Best wishes,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Aviram
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or