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

How to add a column to display related data

3 Answers 28 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Veteran
Patrick asked on 13 Dec 2013, 03:51 PM
I'm sure there's already an answer to my question in the forum, but I haven't been able to locate one:

In a WinForms project I'm using an entity framework entity that represents a table of invoice data: Project_ID, Principal, Interest, etc. Since I'm using an entity representation of a table, it doesn't include, in this case, the ProjectName located in the projects table.  I want my grid to be based on the entity to use the framework's functionality to update the table, but I want a column next to the Project_ID that displays the related ProjectName.  How can I accomplish this?

Thank you in advance for your help.

Patrick

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 18 Dec 2013, 09:12 AM
Hello Patrick,

Thank you for writing.

Since you want to use all the functionality of EntityFramework It seems that your best option is to edit either your Model or your Database schema, which will update the Model and vice versa. This way you will be able to bind to the same Model, however it will have the properties you need and the functionality of EntityFramework.

I hope this helps.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Patrick
Top achievements
Rank 1
Veteran
answered on 20 Dec 2013, 05:44 PM
Thank you for the suggestion.  The only other thing I had thought of was adding a call in the CellFormattng event to get the related data and populate a manually added column. But that would be a lot of trips to the database.  I added a entity to the model that represents a view that included the related data.  It works nicely and I can map CRUD functionality to the entity. Thanks again.
0
George
Telerik team
answered on 23 Dec 2013, 08:23 AM
Hi Patrick,

I am glad that you found a solution for your case. Should you have any further questions, do not hesitate to contact us.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Patrick
Top achievements
Rank 1
Veteran
Answers by
George
Telerik team
Patrick
Top achievements
Rank 1
Veteran
Share this question
or