Displaying Lookup Table Data Values

4 posts, 1 answers
  1. James
    James avatar
    11 posts
    Member since:
    Sep 2011

    Posted 20 Apr 2012 Link to this post

    Assume I have the following two tables:

    Table 1 (Customer) has the following fields:
    1) Customer ID
    2) First Name
    3) Last Name
    4) Street Address
    5) City FK

    Table 2 (City) has the following fields:
    1) City PK
    2) City

    Table 2 is a look-up table that consists of city names.  City PK if the primary key field for the City table.  These primary key values appear as foreign key values in the City FK field of the Customer table.

    I want to add a grid view to a form which shows all of the data in the Customer table.  Instead of showing the foreign key values in the City FK field, I want to show the actual city name which corresponds to the foreign key value stored in this field.  How can I do this with the grid view control? 

    I had placed a grid view on a form and had attached a data set to this control, but the the City column is showing foreign key values for the city instead of the city name.  This is what I don't want the grid view to show.  How can I resolve this problem?


    Thanks.


  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Apr 2012 Link to this post

    Hello, 

    This isn't really a Telerik question as it's down to the datasource that you wish to bind to your grid. However, there are a number of ways. I'd suggest either looking at dataset relations, or simply creating a stored procedure that returns the joined data. 

    Hope this helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. James
    James avatar
    11 posts
    Member since:
    Sep 2011

    Posted 20 Apr 2012 Link to this post

    I looked at the relations tutorial and help documentation relating to this topic.  They all talk about creating a grid view with a master-detail relationship (i.e. parent-child relationship).  I understand this approach but it's not what I want to do.  I could easily construct a SQL statement joining the two tables but I would not be able to edit the data in the grid view when it displays the data.  Could you please direct me to an help/documentation file that would show me how to accomplish what I want to do or attach a sample file to illustrate it?


    Thanks.





  5. Answer
    James
    James avatar
    11 posts
    Member since:
    Sep 2011

    Posted 20 Apr 2012 Link to this post

    I found the solution in the combo box editor tutorial.

Back to Top