Mephisztoe
Mephisztoe

Reputation: 3314

ReportViewer Control and Ajax UpdatePanel

Did anyone of you ever find a way of getting the Microsoft Report Viewer Control (Web) to work from within an Ajax UpdatePanel?

Upvotes: 4

Views: 14286

Answers (5)

Daniel Soares
Daniel Soares

Reputation: 21

Here's a exemple:

<asp:Button ID="Button1" runat="server" OnClick="ViewReport_Clicked" Text="View Report" SkinID="ButtonA" />
<asp:UpdatePanel ID="TFD_UP" runat="server">
    <ContentTemplate>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" SizeToReportContent="True"
            Height="202px" Width="935px" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Visible="false">
            <LocalReport ReportPath="Reports\Report4.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="SqlDataSourceArchiSpecs" Name="Proc_TechFilesDownloadsDataSetParent" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:SqlDataSource ID="SqlDataSourceArchiSpecs" runat="server" ConnectionString="<%$ ConnectionStrings:ArchiSpecsDBConnectionString %>"
            SelectCommand="PROC_TECHNICALFILES_DOWNLOAD_DETAILS" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="supId" Type="Int32" />
                <asp:Parameter Name="startDate" Type="DateTime" />
                <asp:Parameter Name="endDate" Type="DateTime" />
            </SelectParameters>
        </asp:SqlDataSource>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>

Upvotes: 0

JB.
JB.

Reputation: 861

I can also confirm that the latest release (2010) mentioned in previous post corrects issue. It also removes the need to explicitly set AsyncRendering=False: I mention this because other suggestions out there on the web say to set that value on that property

Upvotes: 0

user321101
user321101

Reputation: 31

i fixed this bug by using

Microsoft Report Viewer 2010 Redistributable Package from :

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=a941c6b2-64dd-4d03-9ca7-4017a0d164fd

then change web config as following

from

        <assemblies>                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />                <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />                <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />            </assemblies>
        <assemblies>

            <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

            <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

        </assemblies>

to

  <assemblies>

    <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

    <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </assemblies>

add this to runtime

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

  <dependentAssembly>

    <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/>

    <bindingRedirect oldVersion="9.0.0.0-9.1.0.0" newVersion="10.0.0.0"/>

  </dependentAssembly>

</assemblyBinding>

Upvotes: 3

mattlant
mattlant

Reputation: 15451

The only way really is to create an iframe with the report in there iirc. However, this post here a guy claims he has a way to fix it with some code. albeit i havnt even tried this as I have never had a need to show any of my reports in an update panel. I tend to keep my reports external of any ajax apps, for example when a report is requested i will open a new window with just the report. My users like that better anyhow.

Upvotes: 3

dguaraglia
dguaraglia

Reputation: 6028

Never tried really, but I'm sure that control wouldn't work straight away. I'm pretty sure it needs to load some extra Javascript, because it adds so much complexity, so you might need to load those before updating the panel.

Upvotes: 0

Related Questions