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

Getting results as DataTable

4 Answers 67 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 18 Oct 2011, 04:53 AM
I have a DataTable that is the source for my DataFilter but I need to get the FilteredSource as a DataTable back out. Is there an easy way to accomplish this using the current control?

Thanks,
Shawn

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 20 Oct 2011, 01:35 PM
Hello,

 Can you clarify why you need this?

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
David
Top achievements
Rank 1
answered on 20 Oct 2011, 02:50 PM
We have an existing set of code that utilizes the Telerik ORM to create a DataTable from an open-ended database structure. Due to the dynamic nature of the data being pulled/created, Telerik recommended this approach. We have now written code that generates a report based on the DataTable structure but our customer has requested the ability to filter certain parts of the results from the UI.

In playing around with the DataFilter, we found it could easily answer this as it can filter the DataTable results without a problem but the output was in a ItemDataCollection format which is not compatible with the other code that already exists. Since the report generation code is complex and our time is short for delivery, it is not something we ideally want to rewrite.

I wanted to know if there is a simple way to convert the ItemDataCollection to a DataTable.

0
Accepted
Vlad
Telerik team
answered on 20 Oct 2011, 02:52 PM
Hi,

 You can use the approach from this thread:
http://stackoverflow.com/questions/1253725/convert-ienumerable-to-datatable

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
David
Top achievements
Rank 1
answered on 21 Oct 2011, 09:21 PM
Thanks. That code example worked for me.
Tags
DataFilter
Asked by
David
Top achievements
Rank 1
Answers by
Vlad
Telerik team
David
Top achievements
Rank 1
Share this question
or