none
Report Viewer 2008 to 2010 Migration Issue RRS feed

  • Question

  • Initial load the Report Viewer displays the report. When we change the report parameters to regenerate the dataset that needs to attached as datasource to the Report Viewer it doesn't display, even though the dataset has the data in it. Tried setting the AsyncRendering to false.

    There are multiple datasources, and they are being added dynamically at runtime.

    Please find the code below where we add the mutiple data sources and the datatables have the values and the count is also displayed.

    For Each dataTable As DataTable In dsReport.Tables
                        sDataSourceName = dsReport.DataSetName.ToString() & "_" & dataTable.TableName.ToString()
                        reportSource = New Microsoft.Reporting.WebForms.ReportDataSource(sDataSourceName, dataTable)
                        rptViewer.LocalReport.DataSources.Add(reportSource)
    Next
    iResultsCount = dsReport.Tables(iQueryCountTableIndex).Rows.Count

     

    All these features were working perfectly with the previous version of RDLC.

    Tuesday, January 11, 2011 3:21 PM

Answers

  • The issue got fixed after much toiling through code for what we did to get this to work in the first place on VS 2008. Commented the fix suggested to fix multiple datasources in VS 2008 and it is now working fine in the VS 2010.

     

    Please find the code that was commented to resolve the issue:

        'If rptViewer.LocalReport.DataSources.Count > 0 Then
                    '    Dim cCollection As ControlCollection = rptViewer.Parent.Controls
                    '    Dim index As Int32
                    '    index = cCollection.IndexOf(rptViewer)
                    '    If Not _width = 0 Then
                    '        uWidth = New Unit(_width.ToString)
                    '    Else
                    '        uWidth = New Unit("1000px")
                    '    End If
                    '    If Not _height = 0 Then
                    '        uHeight = New Unit(_height.ToString)
                    '    Else
                    '        uHeight = New Unit("500px")
                    '    End If
                    '    cCollection.Remove(rptViewer)
                    '    rptViewer = New ReportViewer()
                    '    cCollection.AddAt(index, rptViewer)
                    '    'To hide PDF export option
                    '    Call DisableFormat(rptViewer, "PDF")
                    '    Call DisableFormat(rptViewer, "WORD")
                    '    rptViewer.Width = uWidth
                    '    rptViewer.Height = uHeight
                    '    rptViewer.ShowRefreshButton = False
                    'End If

    • Marked as answer by S Sriram Wednesday, January 12, 2011 2:03 PM
    Wednesday, January 12, 2011 2:02 PM

All replies

  • The issue got fixed after much toiling through code for what we did to get this to work in the first place on VS 2008. Commented the fix suggested to fix multiple datasources in VS 2008 and it is now working fine in the VS 2010.

     

    Please find the code that was commented to resolve the issue:

        'If rptViewer.LocalReport.DataSources.Count > 0 Then
                    '    Dim cCollection As ControlCollection = rptViewer.Parent.Controls
                    '    Dim index As Int32
                    '    index = cCollection.IndexOf(rptViewer)
                    '    If Not _width = 0 Then
                    '        uWidth = New Unit(_width.ToString)
                    '    Else
                    '        uWidth = New Unit("1000px")
                    '    End If
                    '    If Not _height = 0 Then
                    '        uHeight = New Unit(_height.ToString)
                    '    Else
                    '        uHeight = New Unit("500px")
                    '    End If
                    '    cCollection.Remove(rptViewer)
                    '    rptViewer = New ReportViewer()
                    '    cCollection.AddAt(index, rptViewer)
                    '    'To hide PDF export option
                    '    Call DisableFormat(rptViewer, "PDF")
                    '    Call DisableFormat(rptViewer, "WORD")
                    '    rptViewer.Width = uWidth
                    '    rptViewer.Height = uHeight
                    '    rptViewer.ShowRefreshButton = False
                    'End If

    • Marked as answer by S Sriram Wednesday, January 12, 2011 2:03 PM
    Wednesday, January 12, 2011 2:02 PM
  • What problem with multiple datasources did you have? I'm using multiple datasources,and I'm not sure what problem you are talking about. Don't want to step in it myself.
    Monday, January 31, 2011 3:26 PM