Showing additional columns/tables for lookup columns

2 posts, 0 answers
  1. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 11 May 2010 Link to this post

    Looking for an idea about how to structure this. We have three related tables, Department, agency and program. Program relates to agency via FK, and Agency relates to Department via FK. We'd like to have a single Radgrid for editing programs, and it's easy to show the lookup for programs, but we'd like to show the department name, the agency name, as well as an additional field from the agency table. Here's the structure (simplified)

    Department
    ===========
    DepartmentID
    DepartmentName

    Agency
    ===========
    AgencyID
    DepartmentID
    AgencyName
    AgencyType

    Program
    ===========
    ProgramID
    ProgramName
    [other columns....]
    AgencyID








    We could create a view that contains all columns, but then I lose the automated editing functionality. Is there a way to create this grid, include the department name and the additional field from the agency table automatically, and still retain the Radgrid editing functionality?

  2. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 12 May 2010 Link to this post

    While it's technically not a RadGrid issue, I've come up with a solution that works at least in this instance.

    I knew that TableAdapters built on queries using JOIN statements don't create Insert/Update/Delete statements, and therefore don't support automatic CRUD functions in the grid. However, I discovered that if the tableadapter is built using correlated subqueries, the insert/update/delete statements are built correctly, the additional field values can be shown, but hide nicely when editing or inserting. Then I used a template item with a multi-column dropdown, that includes both department and agency, to deal with selecting. This was surprisingly easy to get working. I suppose I could have used related dropdowns instead of a single multi-column dropdown, but this seems to work well.

    I can post an example of the code if anyone's interested in seeing it or facing the same challenge.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top