Filtering RadGridView with IQueryable as datasource

3 posts, 1 answers
  1. ado
    ado avatar
    2 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2011 Link to this post


    I have a radgridview which has an IQueryable as datasource. When attempting to filter the radgridview using filter descriptors the fiter descriptors are shown on the grid. But the fields are not filtered. I have an idea this has something to do with the binding?

    The IQueryable is generated in the DAL and returned to the BL which in turn returns it to the WinForm. There is no way to directly access the database as we can only work on the Winform.

    Is it possible to filter the radgridview when it is using an untyped IQueryable as datasource?

    radGridView1.DataSource = BusinessObject.getAll(); //Returns IQueryable
    //Setting filter descriptors
    FilterDescriptor filter = new FilterDescriptor();
                                    filter.Operator = FilterOperator.IsEqualTo;
                                    filter.PropertyName = "Username"t;
                                    filter.Value = "Bob";
                                    filter.IsFilterEditor = true;
                                    this.radGridView1.MasterTemplate.EnableCustomFiltering = true;
                                    this.radGridView1.MasterTemplate.EnableFiltering = true;
                                    radGridView1.ShowFilteringRow = true;
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 08 Sep 2011 Link to this post

    Hello ado,

    Just comment this line
    //this.radGridView1.MasterTemplate.EnableCustomFiltering = true;

    and it will work, because if you want to use custom filtering you should register to the CustomFiltering event and handle the filtering on your side. More info on this here

    Best Regards,
    Emanuel Varga

    (//off topic: I'm back :D)
  3. ado
    ado avatar
    2 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post


    Thanks Emanuel that did the trick! Can't believe it was such a simple mistake. 

    Thank you for the swift reply. Telerik has some amazing products.



    //PS: Welcome back
Back to Top