none
Dynamic GridView with Entity Framework, from joining tables RRS feed

  • Question

  • Hello,

    I'm new to the EF and I want to implement the following functionality. I have the following tables in my model (edmx file).

    TableA (A_ID (PK), content (string), parentID(FK) )

    TableB (B_ID (PK), content (string), parentID FK) )

    TableC( A_ID, B_ID, content(string) ) --A_ID and B_ID form a composite primary key here

    Given a parentID, I want to create an ASP.NET gridview that would display the following:

    [some text]                        | TableA.content[first row] | TableA.content[second row] | ... | TableA.content[last row]

    ========================================================================

    TableB.content[first row]     | TableC.content[A_ID, B_ID] ....

    TableB.content[second row] | ....

    ...

    TableB.content[last row]      | ....

     

    Basically the TableC.content is joined from the corresponding primary keys of the records from tables A and B.

    I want to be able to edit data in the gridview. Currently, I'm considering creating a method for dynamically generating the content of the gridview. However, there will be more hassle when implementing the editing method for the gridview content - for each cell I'll need to store the corresponding A_ID and B_ID, then update it with its new value.

    Is there a more elegant solution in EF that would save the extra effort? What approach would you recommend?

    Thank you!

    Dan

     

    Friday, September 9, 2011 7:35 AM

Answers

All replies