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

Problems getting report to show data

3 Answers 187 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve White
Top achievements
Rank 1
Steve White asked on 19 Nov 2009, 10:37 AM
I'm having a really frustrating time trying to get the reports to work. I've created a report like below:

Partial Public Class JuvenileAges 
    Inherits Telerik.Reporting.Report 
    Public Sub New() 
        InitializeComponent() 
        Dim datatable As DataTable = datatable returned from business class  
        Me.DataSource = datatable 
    End Sub 
End Class 

I've set up the report viewer like this:

<telerik:reportviewer id="ReportViewer1" runat="server" height="438px" width="760px"></telerik:reportviewer> 

Code for the report viewer like this:

Dim rptJuvenileAges As New JuvenileAges() 
ReportViewer1.Report = CType(rptJuvenileAges, Telerik.Reporting.IReportDocument) 
 

When I run the page I see the reportviewer controls on it, but I don't see any data. I know that the datatable is being filled because I ran sql profiler to check that the data was being called.

When I go into design view of the report and right click > View > Data Explorer, I get 'No Data Source' - I guess because I'm adding it programatically.

How do I get the report data to show up in the reportviewer? Any tips much appreciated, as I'm just getting started with reporting.

cheers,

Steve





3 Answers, 1 is accepted

Sort by
0
Steve White
Top achievements
Rank 1
answered on 19 Nov 2009, 05:24 PM
I just updated to latest version of Reports, using VS2008. All the dlls are correct with no conflicts.

I have a simple report and drag a textbox onto the header. When I click Preview, all I get is:

"Exception has been thrown by the target of an invocation. Value cannot be null. Parameter name: key".

Any help pls?
0
Steve White
Top achievements
Rank 1
answered on 19 Nov 2009, 07:13 PM
I'm now using static data to rule out the datatable being a problem.

Partial Public Class JuvenileAges 
    Inherits Telerik.Reporting.Report 
    Public Sub New() 
        InitializeComponent() 
        ' add sample products 
        Dim coffees As Coffee() = New Coffee() {New Coffee("Latte", 1), New Coffee("Mocha", 2), New Coffee("Dark Roast", 3)} 
        ' assign the array to the DataSource 
        Me.DataSource = coffees 
    End Sub 
End Class 
 
Public Class Coffee 
    Private _name As String 
    Private _id As Integer 
    Public Sub New(ByVal name As StringByVal id As Integer
        _name = name 
        _id = id 
    End Sub 
    Public Property Name() As String 
        Get 
            Return _name 
        End Get 
        Set(ByVal value As String
            _name = value 
        End Set 
    End Property 
    Public Property ID() As Integer 
        Get 
            Return _id 
        End Get 
        Set(ByVal value As Integer
            _id = value 
        End Set 
    End Property 
End Class 

In the ReportViewer control I have this:

<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=3.2.9.1104, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" 
    Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %> 
<div id="divForm" runat="server"
    <asp:Label ID="lTitle" runat="server" CssClass="FormHead"></asp:Label> 
    <br /> 
    <asp:Label ID="lErrorMessage" runat="server" ForeColor="#CC0000" Text=""></asp:Label> 
    <telerik:reportviewer id="ReportViewer1" runat="server" height="438px" width="760px"></telerik:reportviewer> 
</div> 

Code:

Dim rptJuvenileAges As Telerik.Reporting.Report = New JuvenileAges() 
ReportViewer1.Report = rptJuvenileAges 
 

I added a breakpoint and it looks like fine.

I used FireBug to debug the response:

    <div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1" style="height:438px;width:760px;"
    <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportTable" cellspacing="0" cellpadding="0" border="0" style="height:100%;width:100%;border-collapse:collapse;"
        <tr style="height:1px;"
            <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar" class="ReportToolbar" style="background-image: url(/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.Background.gif&version=3.2.9.1104&optype=Resource);"
                <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr" class="ReportToolbarGroup" cellpadding="0" cellspacing="0" style="float:left;"
                    <tr> 
                        <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_FirstPage" title="First page"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_FirstPage_Button" class="DisabledButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$FirstPage$ctl00" title="First page" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.FirstPage.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$FirstPage$ctl01" title="First page" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.FirstPageDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td><td width="5px">&nbsp;</td><td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_PreviousPage" title="Previous page"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_PreviousPage_Button" class="DisabledButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$PreviousPage$ctl00" title="Previous page" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.PrevPage.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$PreviousPage$ctl01" title="Previous page" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.PrevPageDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td><td width="5px">&nbsp;</td><td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_CurrentPage" title="Current Page" class="PageNumberText" style="PageNumberTextBoxStyle"
                            <input name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$CurrentPage$CurrentPage" type="text" value="0" maxlength="8" size="3" id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_CurrentPage_CurrentPage" /><span id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_CurrentPage_LabelOf">&nbsp;of&nbsp;</span><span id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_CurrentPage_TotalPages" style="cursor:default;">--</span> 
                        </div></td><td width="5px">&nbsp;</td><td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_NextPage" title="Next page"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_NextPage_Button" class="DisabledButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$NextPage$ctl00" title="Next page" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.NextPage.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$NextPage$ctl01" title="Next page" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.NextPageDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td><td width="5px">&nbsp;</td><td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_LastPage" title="Last page"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_NavGr_LastPage_Button" class="DisabledButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$LastPage$ctl00" title="Last page" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.LastPage.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$NavGr$LastPage$ctl01" title="Last page" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.LastPageDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td
                    </tr> 
                </table><table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_ExportGr" class="InputButtonClass" class="ReportToolbarGroup" cellpadding="0" cellspacing="0" style="float:left;"
 
                    <tr> 
                        <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_ExportGr_FormatList"
                            <select name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$ExportGr$FormatList$DropDownList" id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_ExportGr_FormatList_DropDownList"
                                <option value="Export to the selected format">Export to the selected format</option> 
                                <option value="PDF">Acrobat (PDF) file</option> 
                                <option value="CSV">CSV (comma delimited)</option> 
                                <option value="XLS">Excel</option> 
                                <option value="RTF">Rich Text Format</option> 
                                <option value="IMAGE">TIFF file</option> 
                                <option value="MHTML">Web Archive</option> 
                                <option value="XPS">XPS document</option> 
 
                            </select> 
                        </div></td><td width="5px">&nbsp;</td><td><id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_ExportGr_Export" title="Export" class="DisabledLink" href="#">Export</a></td
                    </tr> 
                </table><table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_RefresGr" class="ReportToolbarGroup" cellpadding="0" cellspacing="0" style="float:left;"
                    <tr> 
                        <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_RefresGr_Refresh" title="Refresh"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_RefresGr_Refresh_Button" class="NormalButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
 
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$RefresGr$Refresh$ctl00" title="Refresh" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.Refresh.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$RefresGr$Refresh$ctl01" title="Refresh" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.RefreshDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td
                    </tr> 
                </table><table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_PrintGr" class="ReportToolbarGroup" cellpadding="0" cellspacing="0" style="float:left;"
                    <tr> 
                        <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_PrintGr_Print" title="Print"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_PrintGr_Print_Button" class="DisabledButton" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$PrintGr$Print$ctl00" title="Print" class="Enabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.Print.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$PrintGr$Print$ctl01" title="Print" class="Disabled" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.PrintDisabled.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td
                    </tr> 
                </table><table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_DocumentMap" class="ReportToolbarGroup" cellpadding="0" cellspacing="0" style="float:left;"
                    <tr> 
                        <td><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_DocumentMap_DocumentMap" style="visibility:hidden;"
                            <table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_DocumentMap_DocumentMap_Button" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;"
                                <tr> 
                                    <td class="ImageButtonCell"><input name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$DocumentMap$DocumentMap$ToolTip" type="hidden" id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportToolbar_DocumentMap_DocumentMap_ToolTip" value="Hide document map|Show document map" /><input type="image" name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$ReportToolbar$DocumentMap$DocumentMap$ctl00" title="Hide document map" src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.DocumentMap.gif&amp;version=3.2.9.1104&amp;optype=Resource" onclick="return false;" style="border-width:0px;" /></td
                                </tr> 
                            </table> 
                        </div></td
                    </tr> 
                </table> 
            </div></td
        </tr><tr style="height:1px;"
            <td><input name="dnn$ctr403$ViewContact$ControlsReports$ReportViewer1$CP" type="hidden" id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_CP" /></td
        </tr><tr style="height:100%;"
            <td style="height:100%;"><div style="width:100%;height:100%;"
                <iframe id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_PreviewFrame" width="0px" height="0px" style="top:-2;z-index:-54321;position:relative;" src="javascript:''" frameborder="0"></iframe><table id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_ReportArea" cellspacing="0" cellpadding="0" border="0" style="border-width:0px;height:100%;width:100%;border-collapse:collapse;"
                    <tr id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_ReportAreaRow" style="height:100%;width:100%;"
                        <td id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_LeftCell" valign="top" style="height:100%;width:1px;"><iframe id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_DocumentMapFrame" width="100%" height="100%" src="javascript:''" frameborder="0"></iframe></td><td id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_SplitterCell" class="ReportViewerSplitterBar" style="height:100%;width:4px;display:none;background-image:url(/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.Splitter.gif&version=3.2.9.1104&optype=Resource);"></td><td id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_RightCell" style="height:100%;"><iframe id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_ReportFrame" width="0px" height="0px" src="javascript:''" frameborder="0"></iframe><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_WaitControl" id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_WaitControl" style="cursor:wait;display:none;width:100%;height:100%;"
                            <table style="width:100%;height:100%;"
                                <tr> 
                                    <td style="vertical-align:middle;text-align:center;"><img src="/PortfolioDev/Telerik.ReportViewer.axd?name=Skins.Default.Loading.gif&amp;version=3.2.9.1104&amp;optype=Resource" alt="Loading image." style="border-width:0px;" /><br/><span class="WaitText">Generating report...</span></td
                                </tr> 
                            </table> 
                        </div><div id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_ErrorControl" class="ReportAreaErrorControl" style="display:none;"
                            <span id="dnn_ctr403_ViewContact_ControlsReports_ReportViewer1_ReportArea_ErrorLabel" class="ReportAreaErrorLabel"></span> 
                        </div></td
                    </tr> 
                </table> 
            </div></td
        </tr> 
    </table> 
</div> 

Can anyone from Telerik help me debug this or let me know a more reliable debugging technique than the one I'm using. There are a couple of 0px settings for width and height in the response, so I need to know if the response looks ok, before I lose the will to live.

cheers,

Steve
0
Steve White
Top achievements
Rank 1
answered on 24 Nov 2009, 11:46 AM
Solved. It looks like the repoprt viewer doesn't like DNN 5+. As soon as I moved the report into a clean page inside a rad window, everything worked. Now I can pass in a string for the reportname into the report page and serve a report based on the string value.
Tags
General Discussions
Asked by
Steve White
Top achievements
Rank 1
Answers by
Steve White
Top achievements
Rank 1
Share this question
or