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

Make builtin header filters query the DB instead of memory, with IQueryable as datasource

4 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
KorsG
Top achievements
Rank 1
KorsG asked on 17 May 2013, 12:56 PM
Hi,

I am using GridView with an IQueryable datasource, together with the builtin header filters.
But when filtering, it just filters the loaded memory object instead of the database. 

I have tried to utilize DynamicLinq, by handling the FilterChanging event like this:

Private FilterDescriptors As New List(Of FilterDescriptor)
 
Private Sub GridView1_FilterChanging(sender As Object, e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles GridView1.FilterChanging
        e.Cancel = True
        For Each f In e.NewItems.OfType(Of FilterDescriptor)()
            FilterDescriptors.Add(f)
        Next
   LoadData() 'Load data here 
End Sub

Then in the LoadData method I have to parse the FilterDescriptor expressions, but this would take some time to get it right, and implementing the various filter operators in DynamicLinq. E.g. the "LIKE" operator needs to be rewritten as ColumnName.Contains(filter) etc.

If my memory serves correct I believe that KendoUI MVC have some builtin functionality to handle this type of situation.
Do you have anything similar in the WinForms toolkit ?
Or do you recommend a different approach ?

(Using VS2012, .NET4.5, Toolkit v. 2013.1.321.40)

4 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 18 May 2013, 07:31 PM
Hello KorsG,

With the built in functionality this will not work as expected,

I will try to provide a solution for this, but I believe it will require Unbound data.

Will return with more info when available.

Best Regards,
Emanuel Varga MVP
0
Anton
Telerik team
answered on 22 May 2013, 11:43 AM
0
KorsG
Top achievements
Rank 1
answered on 24 May 2013, 02:22 PM
Thank you for the responses.

I also tried binding to a datatable (via. the designmode editor of the grid), but it still queries the memory. 
So I guess there's only the manual way to go, maybe with unbound data as you suggest @Emanuel.

It would have been a great feature especially with large datasets and because the builtin filters are superb.

EDIT:
It seems a similar request is already made in PITS: http://www.telerik.com/support/pits.aspx#/details/Issue=11402
0
Accepted
Anton
Telerik team
answered on 29 May 2013, 11:02 AM
Hi Morten,

Thank you for writing back.

Yes. This PITS item is related to your case, so feel free to add your vote for it. The more votes the item receives, the higher it gets in our TODO list.

Let me know if you have additional questions.

Regards,
Anton
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
GridView
Asked by
KorsG
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Anton
Telerik team
KorsG
Top achievements
Rank 1
Share this question
or