I have a class that contains a property-value (property bag) dictionary beside normal properties. I'd like to display a collection of this object in a table using the grid from MvcContrib.
The class:
public class ObjectWithPropertyBag
{
public string Property1 { get; set; }
public string Property2 { get; set; }
public Dictionary<string, string> PropertyBag { get; set; }
}
My GridModel (ObjectWithPropertyBagGridModel):
Column.For(x => x.Property1);
Column.For(x => x.Property2);
Column.For(x => x.PropertyBag)//how to display keys as columns and values as table data
My view:
Html.Grid(ViewData.Model.ObjectWithPropertyBag).WithModel(new ObjectWithPropertyBagGridModel())
Is there any way to iterate through the dictionary and create the columns?
Thanks.