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

Filtering on OpenAccess Linq Query

6 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 1
Kenneth asked on 03 Mar 2009, 03:24 AM
Been using Telerik RadGrid for quite a while, but ran into a problem that I just can't figure out.

I'm using OpenAccess - and have successfully created a working set of persistent classes.

I want to do an "inner join" to flatten the dataset, and was using LINQ (which seemed like the easiest way to do it).

On NeedsDatasource event I set the datasource to a "generic RadGrid" with column names set to autogenerate:

 

            RadGrid1.DataSource = from x in OtogramContext.ObjectScope().Extent<Otogram>()  
                                  select new 
                                  {  
                                      Patient = x.patient.name,  
                                      Physician = x.physicianName,  
                                      HearingLoss = x.AMAHearingScore,  
                                      Clinic = x.clinicName,  
                                      Customer = x.customerID  
                                  }; 

This works great. Really fast, and I can do paging, sorting and grouping - and the column names get picked up automatically from the query. However, when I use the Filter in the RadGrid UI, nothing happens.

What am I doing wrong?

I've already tried this using an OpenAccess datasource and it does work - including filtering. But, its much more tedious (and slow). Would love to figure out how to get filtering to work with the LINQ query above.

Thanks.

6 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 06 Mar 2009, 06:19 AM
Hi Kenneth,
It looks like the filtering is working but only with the primary key column (type of int32). We are investigating the problem. As a temporary workaround I suggest you use the datasource web control for such operations.

Greetings,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kenneth
Top achievements
Rank 1
answered on 06 Mar 2009, 01:58 PM
I would, accept I cannot figure out how to do a inner join with OQL. Can you give me an example of how to do this? Here's a trivial example of what I am trying to accomplish:

public class Patient  
{  
    public string name;  
}  
 
public class Test   
{  
    public DateTime date;  
    public Patient patient;  
}  
 

I need to query "Test" to create a single row with Test.date, Test.patient.name. LINQ does a nice job of doing this, but as you say I can't use it because the RadGrid filter won't work. I would use an OpenAccess datasource - but can't figure out how to use OQL to create the inner join as described above. Is it possible with OQL to do this?

I could step all the way back to using a SQL query - but that seems to defeat the point of using OpenAccess.
0
Kenneth
Top achievements
Rank 1
answered on 06 Mar 2009, 02:00 PM
Also, could you please update my Telerik points for finding this bug?

Thanks.
0
PetarP
Telerik team
answered on 09 Mar 2009, 12:08 PM
Hello Kenneth,
the oql does the join for you. For example we can use the Northwind database where we have Table Order that has reference to table Customer. We can query the Order class and select the customer id by using this
select x.customer.customerID from OrderExtent as  x 
if you go to the oql browser and write this query you will see the respective sql query that contains the joins which are generated by the oql automaticaly.

P.S. The bug you have reported is not bug with the rad grid and OpenAccesss but it is rather related to our LINQ implementation and points were awarded already in a different support thread.

Regards,
PetarP
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dave Whiting
Top achievements
Rank 1
answered on 02 Apr 2009, 10:18 AM
I too am having problems when binding my RadGrid to an OpenAccessDatasource and implementing filtering.

The filtering does filter the results but the number of pages/total items remains the same in my grid.

Is this a related issue with openaccess/radgrid/filtering or something else?

Many Thanks
Mark
0
Thomas
Telerik team
answered on 03 Apr 2009, 06:20 PM
Hello Mark,

the upcoming patch will contain some fixes for the LINQ implementation and also provide a fixed DataSource experience. It should be available within at most three days.

Greetings,
Thomas
Tags
Grid
Asked by
Kenneth
Top achievements
Rank 1
Answers by
Dimitar Kapitanov
Telerik team
Kenneth
Top achievements
Rank 1
PetarP
Telerik team
Dave Whiting
Top achievements
Rank 1
Thomas
Telerik team
Share this question
or