I have a function like this in a static class
public static IEnumerable<MyObject> getFilteredList(int docType)
{
var fItems = from i in list
where i.DocType == docType
select i;
return fItems;
}
When I use this returned list for a data source to my Grid in the form like this for example:
GridControl.DataSource = staticClass.getFilteredList(10)
The Grids DataSource property is null. Can you explain me why this is happening ?
Edit: the list variable is List which contains elements with DocType = 10.
The Items contains elements.
You should use
to create a new
Listinstance to bind to your grid.Another way is to use a
BindingList, which fully supports databinding and gives you usefull events likeListChangedandAddingNew.