Monday, March 26, 2012

ReportViewer - Operation is not valid due to the current state of the object

Hi,
I'm getting an InvalidOperationException, message ("Operation is not
valid due to the current state of the object") when setting the
ServerReport.ReportServerUrl (or ServerReport.ReportPath) property of
the VS2005 ReportViewer control after performing a drilldown.
I've reproduced this error in the following scenario:
1) Clean Windows 2003 server with SP1 and latest hot fixes (installed
to defaults except UK English).
2) Clean SQL Server 2005 (RTM) install with SQL Server and Reporting
Services component (all installed to defaults).
3) Clean VS2005 (RTM) web app (default.aspx and default.aspx.cs, see
below) (running on a Windows XP Pro workstation under VS2005
Development Server but same thing on W2003 Web Server).
4) Clean reports (RSTest.rdl and RSTest2.rdl, see below).
The error can be reproduced as follows:
1) Click Button1 (standard asp:button). This sets
ReportViewer1.ServerReport.ReportPath and
ReportViewer1.ServerReport.ReportUrl to RSTest.rdl and correctly
displays the report.
2) Click the drilldown link in the report. This correctly displays
RSTest2.rdl.
3) Repeat step1. This causes the error.
Relevant code snippets are:
default.aspx:
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
ProcessingMode="Remote">
</rsweb:ReportViewer>
<asp:Button ID="Button1" runat="server" Text="Button"
OnClick="Button1_Click" />
default.aspx.cs:
protected void Button1_Click(object sender, EventArgs e)
{
ReportViewer1.ServerReport.ReportServerUrl = new
Uri("http://dstst1/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/RS Test
Project/RSTest";
}
RSTest.rdl:
<Textbox Name="textbox1">
...snip...
<Action>
<Drillthrough>
<ReportName>RSTest2</ReportName>
</Drillthrough>
</Action>
...snip...
</Textbox>
Has anyone got any ideas or is this a bug as I suspect?
Regards,
Ian Addis
Dorset Software Services Limited
Poole, Dorset, ENGLAND
Keywords: SQL Server 2005 Reporting Services ReportViewer drilldown
InvalidOperationException "Operation is not valid due to the current
state of the object" ServerReport.ReportServerUrl
ServerReport.ReportPathI have this exact same problem but have not found an answer. Did you
figure out the problem and if not how did you work around it? I am
using a nearly identical software configuration.
Scott Wylie
i.p.addis@.dunelm.org.uk wrote:
> Hi,
> I'm getting an InvalidOperationException, message ("Operation is not
> valid due to the current state of the object") when setting the
> ServerReport.ReportServerUrl (or ServerReport.ReportPath) property of
> the VS2005 ReportViewer control after performing a drilldown.
> I've reproduced this error in the following scenario:
> 1) Clean Windows 2003 server with SP1 and latest hot fixes (installed
> to defaults except UK English).
> 2) Clean SQL Server 2005 (RTM) install with SQL Server and Reporting
> Services component (all installed to defaults).
> 3) Clean VS2005 (RTM) web app (default.aspx and default.aspx.cs, see
> below) (running on a Windows XP Pro workstation under VS2005
> Development Server but same thing on W2003 Web Server).
> 4) Clean reports (RSTest.rdl and RSTest2.rdl, see below).
>
> The error can be reproduced as follows:
> 1) Click Button1 (standard asp:button). This sets
> ReportViewer1.ServerReport.ReportPath and
> ReportViewer1.ServerReport.ReportUrl to RSTest.rdl and correctly
> displays the report.
> 2) Click the drilldown link in the report. This correctly displays
> RSTest2.rdl.
> 3) Repeat step1. This causes the error.
> Relevant code snippets are:
> default.aspx:
> <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> ProcessingMode="Remote">
> </rsweb:ReportViewer>
> <asp:Button ID="Button1" runat="server" Text="Button"
> OnClick="Button1_Click" />
>
> default.aspx.cs:
> protected void Button1_Click(object sender, EventArgs e)
> {
> ReportViewer1.ServerReport.ReportServerUrl = new
> Uri("http://dstst1/ReportServer");
> ReportViewer1.ServerReport.ReportPath = "/RS Test
> Project/RSTest";
> }
>
> RSTest.rdl:
> <Textbox Name="textbox1">
> ...snip...
> <Action>
> <Drillthrough>
> <ReportName>RSTest2</ReportName>
> </Drillthrough>
> </Action>
> ...snip...
> </Textbox>
> Has anyone got any ideas or is this a bug as I suspect?
> Regards,
> Ian Addis
> Dorset Software Services Limited
> Poole, Dorset, ENGLAND
> Keywords: SQL Server 2005 Reporting Services ReportViewer drilldown
> InvalidOperationException "Operation is not valid due to the current
> state of the object" ServerReport.ReportServerUrl
> ServerReport.ReportPath|||strw2001@.gmail.com wrote:
> I have this exact same problem but have not found an answer. Did you
> figure out the problem and if not how did you work around it? I am
> using a nearly identical software configuration.
> Scott Wylie
Nope, no solution as unfortunately the company I'm working with is
currently re-negotiating their support agreement with Microsoft. I'm
fairly sure it's a bug though, I was hoping someone from MS would be on
here to comment considering it's easily reproducible.
Ian A.

No comments:

Post a Comment