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

RadGrid filter expression not working with ODataSource

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 17 Jul 2014, 02:32 PM
Hi,

I have a problem using Telerik RadGrid.
When I apply a filter on a data column, I use the filter expression as a Linq expression.
So at the server side I parse it with Dynamic Linq in GridNeedDataSource handler.
The problem is that when I specify "Contains" as a filter, I receive the following as "Linq expression":

ColumnName1 = 1227 && (iif(ColumnName2 == null,\"\", ColumnName2).Contains(\"abc\"))

This expression does not get resolved by the OData request.

This issue start coming when I updated the dll to version 2014.2.618.35.
Earlier I was using version 2012.1.215.35 which was working fine for filtering. Filter expression generated by this old dll was as below:

ColumnName1 = 1227 && (ColumnName2.Contains(\"abc\"))


Thanks

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 22 Jul 2014, 08:22 AM
Hi,

The expressions is required to avoid issues in cases where the ColumnName2 value comes as null instead of empty string. When parsing with the dynamic linq you can handle this case to make sure the generated OData expression is valid. 
You can also check out the RadGrid's full integration with the new RadClientDataSource control which is the recommended way to bind to OData services since it provides much more features and options for configuration compared to the old ODataSource, it will also handle all types of filtering, sorting, grouping and other CRUD operations automatically so there's no need to parse the expressions manually.
More information can be found in this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx?isNew=true
Binding to OData with RadClientDataSource is shown here http://demos.telerik.com/aspnet-ajax/clientdatasource/functionality/filtering/defaultcs.aspx

Regards,
Marin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Vikas
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or