Bind dynamic object to a grid using binding list
New DiscussionHi,
I have recently started working with the dynamic type which was introduced in .NET 4.0. For adding extencibuluty to my already preexisting classes I decided to make them dynamic. Now since the code involves a whole lot of legacy code, refactoring it is a big mess. So there are also some static properties as well.
Here is what my class looks like
public class Person: DynamicObject
{
#region static-properties
public string FirstName{get; set;}
public string LastName{get; set;}
public string FullName{get; set;}
#endregion
private Dictionary _properties;
}
I can add values to it as follows.
Person p = new Person();
p.FirstName = "Ishan";
p.LastName = "Gandhi";
dynamic dynPerson = Person;
dynPerson.Nationality = "Indian";
I want to be able to display these object on ultragrid, but for some reason these dynamic properties are not displayed. I can still see their values in debug mode.
P.S. I am using a bindinglist to bind to grid's datasource.
Since my project would involve many objects, is there another way we can bind these objects to the grid.
Regards
Ishan