I'm using Telerik WinControls 2014.3.1104.40 in a C# environment.
I have a gridview that has a number of preset columns, as well as zero or more additional, user-defined columns. I need a way to load this data into the grid.
Currently, I am trying to use C# "dynamic" objects, in hope that the FieldName property of each column will access that field of the dynamic object; but the grid does not appear to load anything from a list of dynamic objects.
There should be data loaded into the cells, but they show up blank. Here is a sample of the code that is not working:
private
void
LoadData()
{
radGridView1.DataSource =
new
List<dynamic>()
{
CreateDynamicObject(1),
CreateDynamicObject(2),
CreateDynamicObject(3),
};
}
private
dynamic CreateDynamicObject(
int
id)
{
dynamic ret =
new
ExpandoObject();
ret.Id = id;
ret.Prop1 =
"Property 1: "
+ id;
ret.Prop2 =
"Property 2: "
+ id;
return
ret;
}
If List<dynamic> data sources are not supported, what other method would be most similar?