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

Null Reference While Assigning SubReport Source

2 Answers 157 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 29 May 2012, 06:30 PM
IDE : Visual Studio 2010
Reporting Version : Q1 2012 (6.0.12.215)

While I'm trying to assign a ReportSource to a sub report, I get "Object reference not set to an instance of an object.". I had googled this error and came upon this Telerik Post saying to run either in preview or set programatically. I tried both.

Preview Pane :

"Exception has been thrown by the target of an invocation. Object reference not set to an instance of an object."

Programmatically :

"One or more parameters are not set or have invalid values."

After seeing the error, I checked all the parameters and everything seemed to be getting/sending a value. After a few more tries, I finally just took out the parameters and set an ID I knew had data in my database and tried running again. Gave me the same error. I then went through and turned on (Debug -> Exceptions) and set to throw all Common Language Runtime Exceptions, but nothing was thrown.

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 30 May 2012, 01:12 PM
Hello Jacob,

The provided information is insufficient for us to determine what might be the problem. Usually if you do this through the designer, this means there is a problem with the report initialization and running it on its own is the first thing you should try.  If you are after creating a master-detail report with the help of SubReport item, please check the following help article: How-To: Creating Master-Detail Reports Using SubReports. If your goal differs, please elaborate:
  • does the report used as subreport runs on its own?
  • how do you assign the report as report source, did you try using the ReportSource property from the designer?
  • if you're not after master-detail, how are the parameters involved.

You can review the demo Invoice report we ship with the product to see the approach from the help article in action.

Greetings,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Jacob
Top achievements
Rank 1
answered on 30 May 2012, 07:54 PM
- does the report used as subreport runs on its own? 
No, when I was running without the parameters, I was trying to pinpoint the issue.

how do you assign the report as report source, did you try using the ReportSource property from the designer? 
Yes. I was trying to add from the properties pane.

Your second question gave me an idea to set it programmaticly vs from the designer. It now works that way. 
Tags
General Discussions
Asked by
Jacob
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jacob
Top achievements
Rank 1
Share this question
or