locked
ReportViewer 2012 RRS feed

  • Question

  • User-391069186 posted

    Report Viewer 2012 CTP or 11.0 is not letting me load two ReportViewers at the same time.  I'm using local reports for both.

    I have two ReportViewers and the first one is getting loaded while the other one says Object reference not set to an instance of an object.

    The data sources are in there and when I switch the ReportViewers, the FIRST one always works.

    Also after I see the message and I click the refresh button in the second (problem) report it then proceeds to work.  It just doesn't load initially when the page loads.

    This use to work in Report Viewer 10.0

    Tuesday, June 5, 2012 10:57 AM

All replies

  • User-1501801757 posted

    Not sure 100% but could it be just a resource management problem?  What happens if you put a delay in between the load of report 1 and before report 2?  If it is a bug make sure you report it to the development team of RVCTP

    Tuesday, June 5, 2012 11:06 AM
  • User-391069186 posted

    Can you show me how to put the delay?  I can try it.

    I think the problem is when it's rendering it, it doesn't know or can't find the object I'm passing to it.  I just can't find the fix.

    Tuesday, June 5, 2012 11:15 AM
  • User-1501801757 posted
    http://bytes.com/topic/c-sharp/answers/237076-creating-pause-execution
    Tuesday, June 5, 2012 11:21 AM
  • User-1501801757 posted
    Seems Microsoft says its a limitation currently http://social.msdn.microsoft.com/Forums/da-DK/vsreportcontrols/thread/51cf28dc-70d2-4055-aa21-313badee0e94 So put them on separate aspx pages and plop them in Iframe on one page
    Tuesday, June 5, 2012 11:31 AM
  • User-391069186 posted

    I've tried the file delay and it's not working.

    That link you posted above is only for Report Viewer 10.  It mentioned that there is a delay in the file animation logo but IT IS working.  I've experienced that when using Report Viewer 10.

    However this issue pertains to Report Viewer 11.  In my scenario, the second report doesn't work at all.  It has Object Reference not set to an instance of an object.  If someone could point as to how to find the logs for local report it would help.

    Tuesday, June 5, 2012 11:37 AM
  • User-1501801757 posted
    Are you using same name in the code behind for each report? If so make unique.
    Tuesday, June 5, 2012 11:41 AM
  • User-391069186 posted

    Yes of course I am using unique name

    Tuesday, June 5, 2012 12:10 PM
  • User-391069186 posted

    I'm going to try isolate the issue by to creating a simple test web application and see if I can reproduce the problem there.

    Tuesday, June 5, 2012 12:14 PM
  • User-391069186 posted

    Okay the simple test web application was able to reproduce the problem.  This appears to be an issue with Report Viewer 2012 or 11.0 and not 10.0

    Any help from the Microsoft guys would help?

    Tuesday, June 5, 2012 12:29 PM
  • User-1501801757 posted

    My one suggestion would be if possible (Unless you are returning data for both at the same time) to try the iFrame solution while it's still in CTP form. 

    Could you post the code you use?  Is that a possibility?

    Tuesday, June 5, 2012 1:00 PM
  • User-391069186 posted

    Here is the code.  I only posted the relevant info.   Again this works if you use 10.0, if you use 11.0 I found that it breaks:

    aspx:

    <%@ Page Title="Home Page" Language="C#"  AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="TestWebApplication._Default" %>
    
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    
    <form runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
    
    <asp:Button ID="btnViewREport" runat="server" onclick="btnViewREport_Click" text="Button Test"/>
    
    <rsweb:ReportViewer ID="rvTest"  runat="server" Font-Names="Verdana" Font-Size="8pt"  
        WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="100%" Height="570px" Visible="false" >
    </rsweb:ReportViewer>
        
    <rsweb:ReportViewer ID="rvTest2"  runat="server" Font-Names="Verdana" Font-Size="8pt"  
        WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="100%" Height="570px" Visible="false" >
    </rsweb:ReportViewer>
    
    </form>

    aspx.cs:

            protected void btnViewREport_Click(object sender, EventArgs e)
            {
                var dt = ListData(1);
                rvTest.LocalReport.DataSources.Clear();
                rvTest.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
                rvTest.LocalReport.ReportPath = "Report1.rdlc";
                rvTest.Visible = true;
    
                rvTest2.LocalReport.DataSources.Clear();
                rvTest2.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
                rvTest2.LocalReport.ReportPath = "Report1.rdlc";
                rvTest2.Visible = true;
            }

    screenshot:

    Friday, June 15, 2012 2:31 PM
  • User-1501801757 posted

    OKay one of two possiblities.  One is maybe the new Report Viewer doesn't like using the exact same report on same place.  Can you make a copy of Report1 say report2 and use report 2 in the second box to see what happens?  I have a feeling this may be the cause.

    BUT it also could be suggestion two try this code instead of different reports? 

     protected void btnViewREport_Click(object sender, EventArgs e)
            {
                var dt = ListData(1);
                rvTest.LocalReport.DataSources.Clear();
                rvTest.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
                rvTest.LocalReport.ReportPath = "Report1.rdlc";
                rvTest.Visible = true;
    
                var dt2 = ListData(1);            
                rvTest2.LocalReport.DataSources.Clear();
                rvTest2.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt2));
                rvTest2.LocalReport.ReportPath = "Report1.rdlc";
                rvTest2.Visible = true;
            }




     

    Friday, June 15, 2012 2:44 PM
  • User-391069186 posted

    I've tried your suggestion above with two different dt variables and that didn't work.

    Also regarding your first suggestion with 2 reports, the test app is using one report file but my production report is actually using 2 different report files.  It also doesn't work.

    Here is the interesting thing, when I click refresh button on the second report, the second report works and loads.  It's just the initial time, it doesn't work.  Again this use to work in 10.0 and not 11.0

    Friday, June 15, 2012 2:55 PM