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

RadFilter with custom EntityDataSource

5 Answers 111 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Justin Lorenzon
Top achievements
Rank 1
Justin Lorenzon asked on 03 May 2011, 08:03 AM
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?

5 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 06 May 2011, 08:14 AM
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.

0
Justin Lorenzon
Top achievements
Rank 1
answered on 06 May 2011, 08:35 AM
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?
0
Iana Tsolova
Telerik team
answered on 09 May 2011, 02:43 PM
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.

0
jelling
Top achievements
Rank 1
answered on 05 Aug 2011, 08:23 PM
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?



0
Veli
Telerik team
answered on 10 Aug 2011, 01:02 PM
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.

Tags
Filter
Asked by
Justin Lorenzon
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Justin Lorenzon
Top achievements
Rank 1
jelling
Top achievements
Rank 1
Veli
Telerik team
Share this question
or