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

Beginner's problem with RadGrid and LinqDataSource

3 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 22 Oct 2012, 05:33 PM
I have a 4.0 RadGrid on my page that I'm trying to bind to a LinqDataSource.  I originally tried to bind the grid to a LinqDataSource that had a detailed select statement that included crossreferences to foreign keys.  This did not work when it came to updates. 

2 questions.

1.  Do I understand correctly?  The only way I can get Linq to automatically take care of updates is to not have a Select statement in my LinqDataSource.

2. If (1) is correct then am I also correct in assuming that if I want cross-references to other tables I need to manually code them in the <Grid name>_ItemDataBound event?

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Oct 2012, 02:33 PM
Hello Boris,

Straight onto your questions:

1) If you go through the LinqDataSource designer wizard and if you try to select the fields manually you will notice that the Advanced button (where you can enable the automatic operations for the LinqDataSource control)  will be automatically disabled.

2) I would recommend that you examine the following demo (LinqToSql Manual Operations). Note that the manual operations are handled within the UpdateCommand, InsertCommand and DeleteCommand events.

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Boris
Top achievements
Rank 1
answered on 25 Oct 2012, 03:09 PM
Actually I'm kind of leaning towards the 'Let Telerik Do It All' model (and I've already gotten a couple of grids to do just that).

This could be extremely useful.  Thanks.

One other question.  Do I understand correctly?  This example eliminates the need for a LinqDataSource on the page?
(And if so, does this imply that it would be relatively easy to switch the grid to an Entity Framework data source at a future date?)
0
Daniel
Telerik team
answered on 29 Oct 2012, 10:38 AM
Hello Boris,

Yes, the example doesn't use the LinqDataSource control. This also means, that in most scenarios, it would be really easy to switch to EntityDataSource. You can compare the two demos below:
LinqToSql manual operations
EF manual operations

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Boris
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Boris
Top achievements
Rank 1
Share this question
or