Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Bind List<dynamic> to ultragrid1.DataSource?
posted

Can I do this?

  List<dynamic> data = _d.Query<dynamic>(_script).ToList();         // ToList() forces loading                ultraGrid1.DataSource = data;

  ultraGrid1.DataBind();

In the debugger, data is a list of System.Dynamic.ExpandoObjects.

Do I need to put some type of conversion in the middle?

 

 

 

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Guy__L said:
    Can I do this?

    Yes, you can do this. The grid will bind to a List<t>. But a List is not a great data source to use, since it's very limited in the notifications it sends.

    If you use a List, there are certain things that the grid may be unable to do, such as add new rows to the data. The grid probably won't be notified of certain changes to the List, also, such as when you change the value of a property on your ExpandoObject.

    A BindingList<T> is generally a better data source to use.

    But... if you are just displaying the data and you don't need a lot of robust support for adding rows or changing the data outside of the grid, then this code should be fine.

Children