This is a migrated thread and some comments may be shown as answers.

Filtering RadGridView with IQueryable as datasource

2 Answers 244 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ado
Top achievements
Rank 1
ado asked on 07 Sep 2011, 09:13 PM
Hi,

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;
                                this.radGridView1.FilterDescriptors.Clear();
                                this.radGridView1.FilterDescriptors.Add(filter);
                                radGridView1.ShowFilteringRow = true;

2 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 08 Sep 2011, 07:32 AM
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)
0
ado
Top achievements
Rank 1
answered on 08 Sep 2011, 08:42 AM
Hi,

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.

Regards,

A.Do

//PS: Welcome back
Tags
GridView
Asked by
ado
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
ado
Top achievements
Rank 1
Share this question
or