Foreign Key Inferred Name

Last post 11-24-2008 3:24 PM by onisemus. 2 replies.

Sort Posts:

  • Foreign Key Inferred Name

    11-24-2008, 11:28 AM
    • Member
      1 point Member
    • onisemus
    • Member since 11-24-2008, 11:15 AM
    • Posts 2

    So I'm a complete noob to Dynamic Data. My team set up a Dynamic Data website which we're essentially using for scaffolding...we have an already existing DB schema which we plugged it into. And it works perfectly! 

    One thing though - the Dynamic Data code automatically infers a friendly name when generating a drop down list for a foreign key. In our case, we have a "Contacts" table, and the primary key is ContactID, and the first field in the table is "First_Name", and this is what is showing up in the drop down menu. So for instance, when adding or editing an entry in our "Entry" table, it has a foreign key which points to the Contacts table, and it automatically generates a drop down list which friendly names that it has inferred. But the friendly name it picked was the "First_Name" column of the Contact table...which isn't so helpful. For a contact name, you'd probably want first name + last name and maybe even add the company name as well. 

    So how do I change the site and/or data model so that when it creates a drop downlist as a foreign key relationship from my Contacts table, it concatenates the first name and last name columns instead of just displaying the first name column?

    Thanks!

     

    Filed under:
  • Re: Foreign Key Inferred Name

    11-24-2008, 11:47 AM
    Answer
    • Contributor
      5,818 point Contributor
    • ricka6
    • Member since 06-25-2008, 6:04 PM
    • Redmond
    • Posts 936
    • AspNetTeam
      Moderator

    I just blogged on this exact problem. See this post.
     

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
  • Re: Foreign Key Inferred Name

    11-24-2008, 3:24 PM
    • Member
      1 point Member
    • onisemus
    • Member since 11-24-2008, 11:15 AM
    • Posts 2

     Couldn't have asked for a more straightforward answer - exactly what i was looking for! thanks!!

Page 1 of 1 (3 items)