score:3

Accepted answer

you should use

gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();

to create a new list instance to bind to your grid.

another way is to use a bindinglist, which fully supports databinding and gives you usefull events like listchanged and addingnew.

var list = new bindinglist(staticclass.getfilteredlist(10).tolist());

gridcontrol.datasource = list;

score:0

public static ienumerable<myobject> getfilteredlist(int doctype)
    {
        var fitems = from i in list
                     where i.doctype.doctypeid == doctype
                     select i;

        return fitems;
    }

correct me if i am wrong but right now it seems as if you are comparing an int with the doctype class. if that's not the case then your query could just be returning an empty set since it can't find anything that matches.

score:2

try

gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();

because datasource must be inherited from ilist

score:2

you ca try with tolist()

gridcontrol.datasource = staticclass.getfilteredlist(10).tolist();
gridcontrol.databind();

Related Query