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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Trying to use dynamic objects

Thread ID:





116163 Apr 16,2014 05:43 AM UTC Apr 17,2014 04:02 AM UTC ASP.NET MVC (Classic) 1
Tags: Grid
Rajiv Kumar
Asked On April 16, 2014 05:43 AM UTC

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

Alan Sangeeth S [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon