Dynamic Data and lookup tables RRS feed

  • Question

  • User502787105 posted

    Hi Folks

    Table A has a foreign key to table B 

    If my main table A stores a lookup value which is stored within table B - how would I go about displaying the values for table A as the lookup tables description, rather than just the lookupID?

    (Lookup table B - has an id, and a description)


    Friday, September 12, 2008 3:26 AM

All replies

  • User-1005219520 posted

    Dynamic Data automaticly trys to infer the FK name/description field in lieu of the ID. (showing the first string). You can use an attribute to change the displayed field. Are you using Link 2 SQL or Entity Framework? Can you pose the question with a tables from NorthWind or AdventureWorks?

    Friday, September 12, 2008 3:49 AM
  • User-330204900 posted

    You could use the DisplayColumn attribute which tells Dynamic Data which column to diaplay in FK relationships: 

    [DisplayColumn("FullName", "FullName", true)]



    The First version specifies the column to display, the column to sort on, sort descending.

    alternativly if you want to show more than on column in the ParentTable then you could have a look at this article on my blog:

    An Advanced FieldTemplate with a DetailsView. and the project here An Advanced FieldTemplate with a GridView/DetailsView Project.

    Hope this helps [:D]

    Friday, September 12, 2008 5:13 AM