Do you know to embed an RS report in ASP.NET page the right way (using Report Viewer instead of IFrame)?
Updated by Jeoffrey Fischer [SSW] 11 months ago. See history
123
<introEmbed
body={<>
<asideEmbed
variant="info"
body={<>
**Warning:** This rule is obsolete and has been replaced with [Do you know the best way to do printable reports?](https://www.ssw.com.au/rules/do-you-know-the-best-way-to-do-printable-reports)
</>}
figureEmbed={{
preset: "default",
figure: 'XXX',
shouldDisplay: false
}}
/>
Visual Studio provides a Report Viewer control for WebForms, so use it instead of the old IFrame method. The report viewer control is super easy to use - just drag the control into your page designer and select the properties you like.
</>}
/>

The bad old way was to use an IFrame and point it to the report's URL (including parameters). This is bad because you might encounter a typing error. If you want to disable vertical scrollbar, you need to adjust the height of IFrame manually. Furthermore, you can't configure the report's authentication separately.
<IFRAME width="100%" height="700" TITLE="Report" src="http://reports.internal.ssw.com.au/ReportServer?%2fTimeProOnlineReports%2fClientRegisteredProductsByDate&rs:Command=Render&ClientContactID=<%=mintClientContactID%>&ClientExInfo=<%=clientInfo%>&rc:Parameters=false"></IFRAME>
❌ Figure: Bad Example - Embed report using IFrame
<rsweb:ReportViewer ID="ReportViewer1" runat="server" SizeToReportContent="True" ProcessingMode="Remote" Width="100%" AsyncRendering="false"><ServerReport ReportServerUrl="http://reports.internal.ssw.com.au/reportserver"ReportPath="/TimeProOnlineReports/ClientRegisteredProductsByDate" /></rsweb:ReportViewer>
✅ Figure: Good Example - Embed report using Report Viewer

❌ Figure: Bad example - IFrame with vertical scrollbar

✅ Figure: Good example - Report Viewer without vertical scrollbar
Categories
Related rules
Need help?
SSW Consulting has over 30 years of experience developing awesome software solutions.