We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Trying to use dynamic objects

Hi ,
     We have a requirement in which the model would be dynamic and hence I tried to use dynamic (expandoobject) to create a dynamic object.I don't get error but the grid does not display anything other than the arrow key as shown in the attachment. Let me know if binding like that is possible or not if yes how.


Attachment: IssueWithDynamicObjects_65172c64.zip

1 Reply

AS Alan Sangeeth S Syncfusion Team April 17, 2014 04:02 AM UTC

Hi Rajiv,

Thanks for using Syncfusion Products.

We would like to let you know that we have achieved your requirement “binding dynamic objects to Grid” by first converting the dynamic objects to Datatable and then we have binded it to Grid. Pease refer the following code snippets.

Code Snippet:


public static class Extn


public static DataTable ToDataTable(this IEnumerable<dynamic> items)


var data = items.ToArray();

if (data.Count() == 0) return null;

var dt = new DataTable();

foreach (var key in ((IDictionary<string, object>)data[0]).Keys)




foreach (var d in data)


dt.Rows.Add(((IDictionary<string, object>)d).Values.ToArray());


return dt;



public ActionResult GridFeatures()



var obj = new PropertyDynamic();

obj.dynamicProperties = PropertyDynamic.GetDynamicProperties();

IEnumerable data = Extn.ToDataTable(obj.dynamicProperties).AsEnumerable();

return View(data);


For your convenience we have created a sample and the same can be downloaded from below link.



Please let us know if you need any further assistance.

Alan Sangeeth S

Live Chat Icon For mobile
Up arrow icon