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

[Solved] Filtering with custom paging

2 Answers 187 Views
Grid
This is a migrated thread and some comments may be shown as answers.
akohlbeck
Top achievements
Rank 1
akohlbeck asked on 18 Jun 2008, 09:32 PM
Hello.

I am using an ObjectDataSource with my Grid and have implemented custom paging.  Everything seems to work correctly with paging and sorting, which is great.

My problem comes around when I try to add filtering.  I am trying to pass my filter information along to my ObjectDataSource and have modeled it on the solution given in this forum post: http://www.telerik.com/community/forums/thread/b311D-bdabgh.aspx

That all seems to work fine, but I have two questions:

- how can I get the filter expression to not use the DataField of the column ([LastName lik e'%sko%') but instead use a something like a FilterExpression?  I'm asking because the names of the properties on my objects are not the same as the database names and I'd rather set a property on the column with this information.  Is there a way to do this, or do I have to somehow manipulate the FilterExpression string that is returned from the MasterTableView?

- how can I then prevent the built in filtering function from happening?  My data coming back will be sorted and filter correctly, so I do not need the grid to do any of this for me.

If anyone has done something similar, or has some helpful advice, I would appreciate it.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 23 Jun 2008, 03:16 PM
Hi akohlbeck,

Unfortunately such scenario if not supported out-of-the-box. You may consider building a parser/converter in order to map the object properties to the DB field names. 

You can cancel the filtering by hooking to the RadGrid's ItemCommand event, check if the current command is FilterCommand than set the e.Cancel to true in order to cancel the rebind. More information of implementing custom filtering with RadGrid control can be found here.

All the best,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
akohlbeck
Top achievements
Rank 1
answered on 26 Jun 2008, 02:30 PM
Hello.

With the help of the Help, I did find the e.Canceled = true functionality to prevent the built-in filtering from happening.

I then had to keep track of my filtering outside of the grid, since the data fields didn't directly map back to database fields (the grid was bound to an array of objects returned from a service).  I had to remove the filter expression from the grid and then populate the filter textboxes with the filter values.  At least I got case-insensitivity filtering back.  :)

Thanks for the reply.
Tags
Grid
Asked by
akohlbeck
Top achievements
Rank 1
Answers by
Rosen
Telerik team
akohlbeck
Top achievements
Rank 1
Share this question
or