0
votes

I have a web based reportviewer running in local mode using ASP.NET 4.5 and reportviewer version 11. I want to populate it with a datatable. The datatable gets populated but when I run the report only the toolbar shows no report table or errors are displayed.

Here's my code:

    Protected Sub ButtonRunReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonRunReport.Click

ReportViewer1.Reset()
                ReportViewer1.LocalReport.ReportPath = "LMS/ParticipantListSummary.rdlc"
                ReportViewer1.LocalReport.DataSources.Clear()
                ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("LMS_ParticipantListSummary", GetDataTable("Participant List")))

ReportViewerDiv.Visible = True
        ReportViewer1.LocalReport.SetParameters(parameters)
                ReportViewer1.Visible = True
                ReportViewer1.Style.Item("display") = ""
                PanelOpeningMessage.Style.Item("display") = "none"
                ReportViewer1.LocalReport.Refresh()
End Sub

Private Function GetDataTable(ByVal reportType As String) As DataTable

        Dim dt As New DataTable
        Dim connectionString = ConfigurationManager.ConnectionStrings("LMSConnectionString").ConnectionString

        Dim cmdText As String = ... //command text string not shown.

        Using cn As New SqlConnection(connectionString)

        Dim dt As New DataTable()

        Dim state As ConnectionState = connection.State

        Dim adapter As New SqlDataAdapter(cmdText, cn)

        If state = ConnectionState.Closed Then
            connection.Open()
        End If

        adapter.Fill(dt)

        If state = ConnectionState.Open Then
            connection.Close()
        End If
        End Using

    return dt
End Function

Any ideas?

Thanks, Justin.

P.S. Forgot to mention that this was working fine on version 10 of the reportviewer.

1

1 Answers

0
votes

Problem solved!

I had a rogue reportviewer.visible = false causing the report not to render to the browser.

Still not sure why it worked before upgrading to asp.net 4.5 and reportviewer 11.