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

Report With Parameters Gets Object Error

7 Answers 307 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dwayne Starkey
Top achievements
Rank 1
Dwayne Starkey asked on 13 Aug 2009, 02:13 PM
I am evaluating Telerik Reporting tools. I watched your video on adding parameters to a report. I also am using the sample reporting projects code where it displays the report's name in a grid, on selecting the report, it opens the report in another windows and displays the information.

I created a report with a parameter "Team". I can view the report's contents correctly and change the team and get back data within the html preview. Once I try to use the grid to select the report and display outside of VS 2008 I get the error "Object reference not set to an instance of an object".  Not sure why.

I did take the same dataset and not use parameters and the data comes up fine. Any ideas?


Thanks,
Dwayne

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 13 Aug 2009, 03:11 PM
Hi Dwayne,

Can you elaborate - what is the grid you're referring to in your post? Displaying reports in web app/site is accomplished via web report viewer. More information on how to use it and set a report to display is available in Web Report Viewer section of our documentation.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dwayne Starkey
Top achievements
Rank 1
answered on 13 Aug 2009, 03:57 PM
Sorry, let me try ot give more info.
the grid dispays the reprot name:

 


<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
Width="600px" AutoGenerateColumns="False" style="text-align:left;">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="Report">
<ItemTemplate>
<asp:HyperLink id="ReportLink" runat="server" target="_blank" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "NavigateUrl") %>'><%# DataBinder.Eval(Container.DataItem, "Report") %></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="150px" />
</asp:TemplateField>
<asp:BoundField DataField="Description" HeaderText="Description"/>
</Columns>
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

From the Grid you get the report name. When clicking on the name it redirects you to the report viewer and loads the report(in a seperate window). This is when the Object error occurs. If I use no parameters the error does not happen.

 

0
Steve
Telerik team
answered on 14 Aug 2009, 11:38 AM
Hi Dwayne,

Thank you for the clarification - generally speaking you've added one more report to our Visual Studio examples and when you're trying to open it from the "selection grid" you receive an error. It is hard to say what could be the cause of it without looking into the report, but if it is report related it is highly unlikely that it would work in preview but would not work when shown in report viewer. You can add a separate .aspx page to your web site/app with a viewer only, assign the report like so:

Telerik.Reporting.Report report = new MyReport1();
ReportViewer1.Report = report;

and see if the same error is thrown. You can also check out the Output VS window to see if it provides more info about the error. If you have any manual code (i.e. not created by the report designer), you can set a break point and see if the error isn't thrown in it.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dwayne Starkey
Top achievements
Rank 1
answered on 14 Aug 2009, 12:35 PM
Thanks for the reply. I will try creating a new .aspx page and then see if I get the same error.
0
Dwayne Starkey
Top achievements
Rank 1
answered on 14 Aug 2009, 01:40 PM
I created another .aspx page and as long as i do not use report parameters I am fine. When I try to set a report parameter I get the following:
Filters are set to Fields.Team = =Parameters.Team
Report Parameter: Value is set ot W904CH, Name: Team, Visable=True

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.ReportViewer.WebForms.Resources.get_ReportParametersHideAreaText() +40
   Telerik.ReportViewer.WebForms.ParametersButton.CreateChildControls() +140
   System.Web.UI.Control.EnsureChildControls() +87
   Telerik.ReportViewer.WebForms.ParametersButton.set_ShowHideToolTip(String value) +18
   Telerik.ReportViewer.WebForms.ParametersAreaGroup.OnPreRender(EventArgs e) +54
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

It does preview correctly within the designer. I used the code below to view my report within the viewer.

 

Dim report = New ReportLib.Report2

 

ReportViewer1.Report = report

Thanks for all the help, hope you have more direction.


Dwayne




0
Accepted
Steve
Telerik team
answered on 14 Aug 2009, 01:48 PM
Hello Dwayne,

It would be best if you zip and attach your sample project to a support ticket or provide a link from where we can download it. Once we review it, we would be able to provide you with more info.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dwayne Starkey
Top achievements
Rank 1
answered on 20 Aug 2009, 12:08 PM
Here is the fix I received from Telerik Team (Steve). 

"The problem is that you have added a resx file in App_GlobalResources which does not contain any key-value pairs. Thus the viewer is trying to load them from the file, but since it cannot find any it recognizes - throws exception. Delete this file and the report should show in the viewer just fine. "

Thanks for the help
Tags
General Discussions
Asked by
Dwayne Starkey
Top achievements
Rank 1
Answers by
Steve
Telerik team
Dwayne Starkey
Top achievements
Rank 1
Share this question
or