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

How do I serialize FilterDescriptions in GridCommand?

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Corbett
Top achievements
Rank 1
Daniel Corbett asked on 26 Aug 2010, 08:08 PM
There's a route to deserialize GridCommand (GridCommand.Parse), that takes serialized versions of orderBy, groupBy, and filterBy.   I can find ways to serialize sortDescriptors & groupDescriptors, but I can't find code that will serialize filterDescriptors into the same serialized string.

I see an example of what it serializes to, and I can see code in GridBoundColumnSerializer.cs that converts it to a Dictionary, but nothing that turns it into a string.

I need this because I need to create my LINQ query in a webservice, and pass it through my MVC Controller.    I need to pass it through in order to add additional search criteria from the search form (that aren't represented in the result DTO that is sent back).

Unfortunately passing CommandGrid to the WebService fails, because the FilterDescriptors don't serialize automatically.
Passing List<FilterDescriptor> fails as well.
I tried using XMLSerializer to serialize it, but it fails because CompositeFilterDescriptor has a Collection of IFiltorDescriptor in it, and it can't serialize interfaces.

Please assist.

Thanks,

   - Daniel

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Aug 2010, 04:02 PM
Hi Daniel Corbett,

We don't have code which serializes filter descriptors. We only have code which deserializes them. Perhaps you can use some the extension methods which accept the filter expression as a string. You can check the QueryableExtensions.cs file from the source distribution. Also you can check the web service binding example if you have not already.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Daniel Corbett
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or