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

The data is not visualized in WPF ReportViewer

5 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 23 Aug 2016, 03:15 PM

Hello, after I have updated WPF Controls and Telerik.Reporting libraries from Q2 2014 to Q1 2016 (WPF NoXAML 2016 Q1), I can't see any data in my reports (except table headers). But there are some errors in output window:

*** ProcessReport #0 STARTED ***
Exception thrown: 'System.OperationCanceledException' in mscorlib.dll
Exception thrown: 'System.OperationCanceledException' in Telerik.Reporting.dll
Exception thrown: 'System.OperationCanceledException' in Telerik.Reporting.dll
*** ProcessReport #0 DONE in 00:00:00.1307766 ***

In my code I do something like this:

var reportSource = new InstanceReportSource {ReportDocument = rep};
reportview.ReportSource = reportSource;
reportview.RefreshReport();

 

Please help me to solve this problem! Thanks

5 Answers, 1 is accepted

Sort by
0
Sergey
Top achievements
Rank 1
answered on 23 Aug 2016, 04:50 PM

For dataSource I use next class with abstract ReportDataItem:

    public class ReportDataSet : OlbExternalObject
    {
        public string DataMember { get; set; }
        public List< ReportDataItem> DataItems { get; set; }


        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<DealOwnReportRow> GetDealOwnDataItems()
        {
            return DataItems.ConvertAll(ItemToReportDealOwnDataItem);
        }

 

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<OrderReportRow> GetOrderDataItem()
        {
            return DataItems.ConvertAll(ItemToReportOrderDataItem);
        }


        private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
        {
            return item as OrderReportRow;
        }

        private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
        {
            return item as OrderReportRow;
        }

}

 

When I bind that object to report table I use ObjectDataSource

var ods = new ObjectDataSource
                    {
                        DataSource = dataset,
                        DataMember = dataset.DataMember // "GetDealOwnDataItems"
                    };

((DataItem) dataItem).DataSource = ods;

It had worked before I upgraded controls version, but now I have empty report table. But if I change my generic code to 

((DataItem) dataItem).DataSource = dataset.GetDealOwnDataItems()

it will work!

Is it possible to use generic solution (as I wrote) now? How can I fix my problem?

0
Sergey
Top achievements
Rank 1
answered on 23 Aug 2016, 04:51 PM

For dataSource I use next class with abstract ReportDataItem:

    public class ReportDataSet : OlbExternalObject
    {
        public string DataMember { get; set; }
        public List< ReportDataItem> DataItems { get; set; }


        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<DealOwnReportRow> GetDealOwnDataItems()
        {
            return DataItems.ConvertAll(ItemToReportDealOwnDataItem);
        }

 

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<OrderReportRow> GetOrderDataItem()
        {
            return DataItems.ConvertAll(ItemToReportOrderDataItem);
        }


        private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
        {
            return item as OrderReportRow;
        }

        private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
        {
            return item as OrderReportRow;
        }

}

 

When I bind that object to report table I use ObjectDataSource

var ods = new ObjectDataSource
                    {
                        DataSource = dataset,
                        DataMember = dataset.DataMember // "GetDealOwnDataItems"
                    };

((DataItem) dataItem).DataSource = ods;

It had worked before I upgraded controls version, but now I have empty report table. But if I change my generic code to 

((DataItem) dataItem).DataSource = dataset.GetDealOwnDataItems()

it will work!

Is it possible to use generic solution (as I wrote) now? How can I fix my problem?

0
Sergey
Top achievements
Rank 1
answered on 23 Aug 2016, 08:06 PM

I think problem is here 

var ods = new ObjectDataSource
                    {
                        DataSource = dataset,
                        DataMember = dataset.DataMember // "GetDealOwnDataItems"
                    };

Now it's impossible to set object as DataSource (only Type), is it correct? Have it changed since 2014 Q1 ?

0
Sergey
Top achievements
Rank 1
answered on 23 Aug 2016, 08:06 PM

I think problem is here 

var ods = new ObjectDataSource
                    {
                        DataSource = dataset,
                        DataMember = dataset.DataMember // "GetDealOwnDataItems"
                    };

Now it's impossible to set object as DataSource (only Type), is it correct? Have it changed since 2014 Q1 ?

0
Stef
Telerik team
answered on 26 Aug 2016, 08:47 AM
Hello Sergey,

Please test to upgrade to the latest Telerik Reporting version, where the ObjectyDataSource will execute the data-retrieval method of the specified as ObjectDatasource.DataSource data object.

Installing Telerik Reporting


In general, the purpose of the ObjectDataSource component is to provide data to the report in a declarative manner. The ObjectDataSource.DataSource should be the assembly qualified name or Type of the data access layer (class), where the reporting engine will use System.Reflection to create the instance of the class (by using the its default constructor) and to execute the method specified by the ObjectDataSource.DataMember property.

Already instantiated data objects can be set directly as a data item's DataSource, without being wrapped in a data source component.


I hope this helps.


Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Sergey
Top achievements
Rank 1
Answers by
Sergey
Top achievements
Rank 1
Stef
Telerik team
Share this question
or