2025 Feb 12 1:59 PM - edited 2025 Feb 12 2:48 PM
Hi,
Crystal Report Viewer does not display the report content when placed inside an UpdatePanel in ASP.NET Web Forms.

Please refer the below code.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="ReportViewerContainer" style="width: 100%; height: 95vh;">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" HasRefreshButton="True" HasCrystalLogo="False" HasToggleParameterPanelButton="False" ToolPanelView="None" EnableDatabaseLogonPrompt="False" HasDrillUpButton="False" HasExportButton="False" HasPrintButton="False" BestFitPage="False" Width="100%" Height="100%" />
</div>
<asp:Button ID="ApplyFormula" runat="server" Text="Button" style="display:none" OnClick="ApplyFormula_Click" />
</ContentTemplate>
</asp:UpdatePanel>
If I move the div (ReportViewerContainer) and CRViewer outside UpdatePanel, report is displayed properly.
Can someone help me on this?
Thanks in advance!!
Request clarification before answering.
Hello, did you manually change the code or did you let VS generate it?
R&D tested this and noted there is a difference.
"I tried VS2019 with SP39 and it did work. (note: SP 39 is in testing)
But my aspx showed a little different code:"
<form id="form1" runat="server">
<div>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1200px" ReportSourceID="CrystalReportSource1" ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Width="1104px" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="Grouping and Sorting.rpt">
</Report>
</CR:CrystalReportSource>
</ContentTemplate>
</asp:UpdatePanel>
</form>
for clarity your code, it is quite different:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="ReportViewerContainer" style="width: 100%; height: 95vh;">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" HasRefreshButton="True" HasCrystalLogo="False" HasToggleParameterPanelButton="False" ToolPanelView="None" EnableDatabaseLogonPrompt="False" HasDrillUpButton="False" HasExportButton="False" HasPrintButton="False" BestFitPage="False" Width="100%" Height="100%" />
</div>
<asp:Button ID="ApplyFormula" runat="server" Text="Button" style="display:none" OnClick="ApplyFormula_Click" />
</ContentTemplate>
</asp:UpdatePanel>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, I did manually change the Crystal Report Viewer properties as per our requirement.
I am facing this issue only when I have BestFitPage property as false and Crystal Report Viewer is inside an Update Panel. If I set BestFitPage to true, report is displayed successfully. However, report alignment gets changed and it does not match with our UI requirement. So we had to set - BestFitPage="False" Width="100%" Height="100%".
User | Count |
---|---|
63 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.