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

Top Tip : how to use LoadSettings() with an OpenAccessLinqDataSource

1 Answer 47 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Eric Mooiweer
Top achievements
Rank 1
Eric Mooiweer asked on 11 Mar 2015, 04:19 PM
When using LoadSettings() with an OpenAccessLinqDataSource be careful to specify DataSourceControlID="MyOpenAccessLinqDataSource" and not FilterContainerID="MyRadGrid".

If you're not using LoadSettings(), the RadFilter works OK with both strategies but if you're using a OpenAccessLinqDataSource and doing LoadSettings() then you must make the RadFilter element's DataSourceControlID attribute to refer to your datasource.

The demo for the Loading and saving of filter expressions uses a SQL data source and makes the filter point to the grid:

<telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="RadGrid1"></telerik:RadFilter>

If instead of a SQL data source, you use a OpenAccessLinqDataSource, strange things will happen to the queries. For some reason, the query will be run a first time and then a second time but with the filter appearing *double* (where mycolumn = 1 and mycolumn = 1).

It won't fail but naturally, you don't want to execute your queries twice.

Also, visible during debug:
- in the output, a SqlSyntaxError error is thrown
- the _Selecting() event handler of the data source is called twice; the first time the data source's where property shows the correct where clause (as defined by the RadFilter that was set using LoadSettings() ); the second time with the radfilter's conditions repeated.

I found that declaring RadFilter as seen in the demo for integration with the data source works :

<telerik:RadFilter runat="server" ID="RadFilter1" 
  DataSourceControlID="EntityDataSourceCustomers" 
 OnApplyExpressions="RadFilter1_ApplyExpressions">
</telerik:RadFilter>

NOTE: I am not sure if this behaviour is specific to OpenAccessLinqDataSource or if it also happens with the SQL source. I didn't check.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 16 Mar 2015, 03:49 PM
Hi Eric,

Thank you for sharing your findings.
It is strange that the condition is repeated. I will check it and if it is a bug we will try to fix this.

Regards,
Vasil
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
Filter
Asked by
Eric Mooiweer
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or