0

I'm using Dynamic Data .NET 4 with scaffolding to edit data in my database. I'm using LINQ to SQL, and I have a table that contains 3 fields that all reference the same table with their foreign keys:

Matches

  • TeamAId - Foreign key references a team in the Teams table
  • TeamBId - Foreign key references a team in the Teams table
  • WinnerId - Foreign key references a team in the Teams table

By default, Dynamic Data creates "Team", "Team1", "Team2" labels for these fields since it's trying to be smart about the foreign keys, but this isn't particularly helpful in differentiating among them. Is there an easy way to force the use of the original column names? Or must I create custom EntityTemplates to change these labels?

narolc
  • 1

1 Answers1

1

Use the DisplayAttribute

[Display(Name = "Team A")]
public object Team { get; set; }

[Display(Name = "Team B")]
public object Team1 { get; set; }

[Display(Name = "Winner")]
public object Team2 { get; set; }
Ash Machine
  • 9,601
  • 11
  • 45
  • 52
  • how can I bind different data into dropdownlist.. as by default it is binding data of FK like Username in this all Username will be there in dropdown if i want only few then how can i do that? – Neo Sep 17 '12 at 12:27