RadFilter with custom EntityDataSource

6 posts, 0 answers
  1. Justin Lorenzon
    Justin Lorenzon avatar
    4 posts
    Member since:
    Mar 2010

    Posted 03 May 2011 Link to this post

    I've been working through getting RadFilter to work with our datasource class, derived from EntityDataSource. The RadFilter throws a null ref on apply:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Web.UI.RadFilter.ApplyFilterExpressonsOnDataSource() +157
       Telerik.Web.UI.RadFilter.HandleApplyCommand() +218
       Telerik.Web.UI.RadFilterCommandEventArgsFactory.HandleCommand(RadFilter ownerFilter, Object commandSource, RadFilterCommandEventArgs args) +74
       Telerik.Web.UI.RadFilter.OnBubbleEvent(Object source, EventArgs args) +319
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

    After working through all our modifications to try and figure out what was causing this by process of elimination I was disappointed to find that the RadFilter simply throws it on ANY derived DataSource. All you need to do is create an empty class which extends EntityDataSource, point a RadFilter at it, and it fails to apply with the above exception.

    Is there a way to work around this?
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 06 May 2011 Link to this post

    Hi Justin,

    Currently RadFilter can be integrated only with LinqDataSource, EntityDataSource and OpenAccessDataSource. It does not provide support for inherited data source controls.
    To overcome the issue, you can try handling the ApplyExpressions event manually.

    Kind regards,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Justin Lorenzon
    Justin Lorenzon avatar
    4 posts
    Member since:
    Mar 2010

    Posted 06 May 2011 Link to this post

    Hi Iana thanks for the reply.
    I will have to use the workaround you suggest for now but in doing so I'll also have to manually replicate the field generation you get when you hook an RF up to an entitydatasource too.

    The thing is I see no reason for this limitation; any derived datasource should function indistinguishably from its base class or it's violating LSP, surely it would be a trivial change (and better OO design) to allow derived classes?
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 09 May 2011 Link to this post

    Hi Justin,

    RadFilter creates different filter expressions based on the type of the data source control is attached to. That is why it can work with the .NET and Telerik OpenAccess data source controls, and not with custom ones.

    All the best,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. jelling
    jelling avatar
    13 posts
    Member since:
    Aug 2006

    Posted 05 Aug 2011 Link to this post

    I have the same issue as the OP. To restate his question, if one creates a custom data source control that derives from a supported data source type (ex. LINQ data source), why wouldn't RadFilter see this still as a LINQ type and pass LINQ filters?

    If it did that we could handle them appropriately inside the data-source control.

    Since some time has passed, has this been fixed perhaps?



  7. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 10 Aug 2011 Link to this post

    Hi jelling,

    RadFilter currently does not support data source types derived from EntityDataSource and OpenAccessDataSource. DataSources derived from LinqDataSource work OK, though. Attaching a test project to demonstrate.

    Veli
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

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