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:
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 :
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.
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.