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

2 posts, 0 answers
  1. Eric Mooiweer
    Eric Mooiweer avatar
    4 posts
    Member since:
    Feb 2010

    Posted 11 Mar 2015 Link to this post

    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.
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Mar 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top