Filtering on OpenAccess Linq Query

7 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    70 posts
    Member since:
    Feb 2008

    Posted 02 Mar 2009 Link to this post

    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.

  2. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 06 Mar 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kenneth
    Kenneth avatar
    70 posts
    Member since:
    Feb 2008

    Posted 06 Mar 2009 Link to this post

    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.
  5. Kenneth
    Kenneth avatar
    70 posts
    Member since:
    Feb 2008

    Posted 06 Mar 2009 Link to this post

    Also, could you please update my Telerik points for finding this bug?

    Thanks.
  6. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 09 Mar 2009 Link to this post

    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.
  7. Dave Whiting
    Dave Whiting avatar
    41 posts
    Member since:
    Jan 2007

    Posted 02 Apr 2009 Link to this post

    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
  8. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 03 Apr 2009 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017