How to databind a gridview to an ExpandoObject

后端 未结 1 770
刺人心
刺人心 2021-01-12 00:35

When I try to databind an ASP.NET GridView to an IEnumerable using an ObjectDataSource, I get the following excep

1条回答
  •  囚心锁ツ
    2021-01-12 01:06

    The opensource framework Impromptu-Interface can do this. It has a method for exposing dynamic object properties for reflection by passing in a dictionary of property names->types.

    IEnumerable tProxiedObject = listOfExpandos.Select(x=>Impromptu.ActLikeProperties(x, x.ToDictionary(k=>k.Key,v=>typeof(object))));
    

    0 讨论(0)
提交回复
热议问题