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

Report works, but not in designer?

3 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dustin Dodson
Top achievements
Rank 1
Dustin Dodson asked on 29 Dec 2010, 03:48 PM
OK, I'm using a ObjectDataSource. I know the Data Source works fine, because if I plug it into a telerik grid I have no issues at all.

When I try to show it in the report viewer in aspx I have to go through a lot of stuff, but the report works... so it's not a show stopper.

It would be nice to be able to view small changes I make on the report with the designer preview instead of having to run my project every time I want to see if a font change looks right or not.

The error message I'm getting is: 
An error has occurred while processing Report 'HealthInspectionRpt':
Exception has been thrown by the target of an invocation.
------------- InnerException -------------
Object reference not set to an instance of an object.


this is in the designer.

when I view it with a report viewer on an aspx page, this is how I have to load it from the code behind...
if (!Page.IsPostBack)
      {
            Telerik.Reporting.ObjectDataSource obDS = new Telerik.Reporting.ObjectDataSource();
            obDS.DataSource = typeof(HealthInspectionRptData);
            obDS.DataMember = "GetHealthInspectionReport";
            obDS.Parameters.Add(new Telerik.Reporting.ObjectDataSourceParameter("ProgramYear",typeof(int),    
                  (int)min2ProgramYearChosen));
             obDS.Parameters.Add(new Telerik.Reporting.ObjectDataSourceParameter("ProgramID",typeof(int),
                  (int)mudtProgramID));
                              
             Telerik.Reporting.Report rpt = new HealthInspectionRpt();
                 
             rpt.DataSource = obDS;
 
             rptViewer.Report = rpt;               
             rptViewer.RefreshReport();
                 
             //HealthInspectionRpt hInspRpt = new HealthInspectionRpt(min2ProgramYearChosen, min4SponsorID, mudtProgramID);                               
             //rptViewer.Report = hInspRpt;
}

I was thinking that the commented out part here at the bottom would have covered it... but it gives me the same error as the designer.

Anyone ever run into this issue?

Thanks,

Dustin

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 03 Jan 2011, 03:21 PM
Hi Dustin,

You should set the data source for the report in the report designer in order to have Preview available as we do some special handling for this purpose. When the data source is set in the calling application, Visual Studio in which context we execute the Preview has no idea where to look for the data source.

Regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Dustin Dodson
Top achievements
Rank 1
answered on 03 Jan 2011, 03:38 PM
The bad part is that I have set the data source in the report... that was actually the first way I tried... mostly because it was the easiest of course.. But I still couldn't get the report to work at all that way... I finally found how to set it programatically which is the only way I was able to get it to run period. I haven't tried it with an SQL DS, but I don't see how that should matter... When I set up the Object DS the fields show up in the data browser and I can drag and drop them onto the report, so I know it's communicating with the DS... it's just seems like it's not initializing the ObjectDataSource whenever I switch over to the design view for some reason.

LOL... Well I was going to send you some screen shots... but this is what I'm getting now when I try to open the report...

So.. now I'm completely lost.... yet the report still works through the report viewer in my .aspx page...

Any ideas?

Thanks,

Dustin.
0
Steve
Telerik team
answered on 04 Jan 2011, 06:08 PM
Hello Dustin,

We're not sure what is the cause for the missing Preview when you have used the ObjectDataSource Component as data source for the report, so we would appreciate if you elaborate on the exact problem or error you've encountered. Simply stating that something did not work does not help us in pinpointing the culprit. Our suggestion is to review the referenced help section for information on how to use the ObjectDataSource and the following video which shows a simple example: Connecting to Data in Telerik Reporting with the ObjectDataSource Component.

Kind regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Dustin Dodson
Top achievements
Rank 1
Answers by
Steve
Telerik team
Dustin Dodson
Top achievements
Rank 1
Share this question
or