Solve Hierarchical One-to-Many Relationship in Dynamic Data Application

How to correctly display the value of a parent-child relationship and also be able to select items on the DropDownList  in ASP.NET Dynamic Data web application?

This method will work with either a recursive or hierarchical relationship between a table and itself, or a relationship between two different tables or entities.

It also works with either Entity Framework or Linq To SQL.

The solution is simple:

Create a partial class of the entity and define a DisplayColumn attribute.


using System.ComponentModel.DataAnnotations;

namespace Examples
    public partial class Category




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s