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?
7 Answers, 1 is accepted
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.
the Telerik team
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" />
<asp:HyperLink id="ReportLink" runat="server" target="_blank" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "NavigateUrl") %>'><%# DataBinder.Eval(Container.DataItem, "Report") %></asp:HyperLink>
<ItemStyle Width="150px" />
<asp:BoundField DataField="Description" HeaderText="Description"/>
<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" />
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.
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.
the Telerik team
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.
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.
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.
the Telerik team
"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