How to add a column to display related data

4 posts, 0 answers
  1. Patrick
    Patrick avatar
    10 posts
    Member since:
    Jul 2011

    Posted 13 Dec 2013 Link to this post

    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
  2. George
    Admin
    George avatar
    500 posts

    Posted 18 Dec 2013 Link to this post

    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 >>
  3. Patrick
    Patrick avatar
    10 posts
    Member since:
    Jul 2011

    Posted 20 Dec 2013 Link to this post

    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.
  4. George
    Admin
    George avatar
    500 posts

    Posted 23 Dec 2013 Link to this post

    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 >>
Back to Top