Accessing the HTML5 WebForms ReportViewer from the code behind

0 Answers 119 Views
.NET Framework Report Parameters Report Viewer - HTML5 WebForms
Top achievements
Rank 1
Gail asked on 10 Feb 2022, 11:40 PM


I am trying to use the HTML5 WebForms Report Viewer in an ASP.NET WebForms (.NET Framework 4.6.1) application.  I am using Telerik Reporting version

I need to update the report source and parameters from the code behind, and I have not been able to get this to work. 

My report displays correctly when the page first loads.  Then, I select a choice from a drop-down list on the page.  I attempt to change the parameter and datasource in an event in the code behind.  When the screen refreshes, the report viewer is no longer there.

My report viewer is inside of an UpdatePanel on the page, like this:

			<asp:UpdatePanel ID="UP1" UpdateMode="Always" runat="server">

					<%--practice group list and practice ddl--%>
					<div style="width: auto;">
						<uc:wucPracticeListAndPractice ID="PracticeAndListBar" runat="server"
						ControlStyle="Bar" AdjustWidths="True" SelectionsAreSticky="True"
						AllowAllPractices="false" />

					<div style="border: 2px solid red;">

							runat="server" ServiceUrl="https://localhost:44364/api/reports" >
							<ReportSource Identifier="Samples/TestReport.trdp" IdentifierType="UriReportSource">
									<telerik:Parameter Name="AccountOid" Value="00000000-0000-0000-0000-000000000000" />
							<%-- If set to true shows the Send Mail Message toolbar button --%>
							<SendEmail Enabled = "false" />

						<telerik:DeferredScripts runat="server"></telerik:DeferredScripts>



In my event in the code behind:

            ReportSource reportSource = new ReportSource()
                Identifier = "Samples/TestReport.trdp",
                IdentifierType = IdentifierType.UriReportSource
            reportSource.Parameters.Add("AccountOid", Guid.Empty.ToString());

            this.reportViewer.ReportSource = reportSource;

Any suggestions on what I might be doing wrong?

Thank you.

Telerik team
commented on 15 Feb 2022, 01:07 PM

Hi Gail,

The provided code seems correct to me. I would suggest sending us a sample project that demonstrates the issue, so we can inspect it locally. You may find helpful the How to Pass Values to Report Parameters article.

No answers yet. Maybe you can help?

.NET Framework Report Parameters Report Viewer - HTML5 WebForms
Asked by
Top achievements
Rank 1
Share this question