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

Grid LinqDataSource binding - Foreign key field

2 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Giancarlo
Top achievements
Rank 1
Giancarlo asked on 12 Jun 2012, 01:15 PM
Hi,
I have a grid binded to LinqDataSource  (tablename='Region') that show 2 fields "id" and "description".
I want to display also a field "description" of another table ('State') in relathion with the first by stateID Field ( foreign key).
How can I show this last field in my grid?
Thanks a lot to all
Gaetano


2 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 15 Jun 2012, 10:46 AM
Hello,

 If the Region entity also has a property that holds a reference to the related table you can bind the foreign key field through this nested property (e.g. DataField="State.Description"). Otherwise the grid has to be bound to an entity that has all the needed fields that will be shown or you can manually retrieve and set the proper value for the additional description field in the ItemDataBound event. 

Regards,
Marin
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
Giancarlo
Top achievements
Rank 1
answered on 18 Jun 2012, 10:56 PM
Thank you so much.
"State.Description" field works fine.
Gaetano
Tags
Grid
Asked by
Giancarlo
Top achievements
Rank 1
Answers by
Marin
Telerik team
Giancarlo
Top achievements
Rank 1
Share this question
or