This is a migrated thread and some comments may be shown as answers.

Parameterised Reports with ASP.net WebForms

4 Answers 262 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 18 Dec 2018, 11:28 PM

Hi

I am trying to add my first parameterised report to an ASP.net WebForms application.  I cannot figure out how to pass the parameter.  Having searched, a lot of posts are old, lead to blank pages, examples that use the old report viewer not the HTML 5 one and I cannot convert it etc.

I have created a .trdp file and added it to the project.  It takes a parameter and the report works in preview, if I Hard code the parameter.

My front end code to add the report viewer is:

01.<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ContractDisplay2.aspx.vb" Inherits="Intranet3.ContractDisplay2" %>
02. 
03.<%@ Register Assembly="Telerik.ReportViewer.Html5.WebForms, Version=12.2.18.1129, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.Html5.WebForms" TagPrefix="telerik" %>
04. 
05.<!DOCTYPE html>
06. 
08.<head runat="server">
09.    <title></title>
10.</head>
11.<body>
12.    <form id="form1" runat="server">
13.        <div>
14.            <p>report:</p>
15.        <telerik:ReportViewer ID="ReportViewer1" runat="server"  style="border:1px solid #ccc;"
16.            width="99%" height="99%"/>
17.        </div>
18.    </form>
19.</body>
20.</html>

 

and in my code behind I have this:

1.Dim reportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource()
2.            reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource
3.            reportSource.Identifier = "ConsignmentProductReport.trdp"
4.            reportSource.Parameters.Add("AccountNo", "ABC123")
5.            ReportViewer1.ReportSource = reportSource

 

The problem is that when I run it, the report is not rendered.

Please can someone advise how to do this using WebForms / HTML5 viewer and .trdp files?

Thanks

4 Answers, 1 is accepted

Sort by
0
Stuart
Top achievements
Rank 1
answered on 19 Dec 2018, 11:05 AM

As is often the case after posting for help, and a night's sleep, I have solved my problem :)

So that no-one spends time on this, and in case it helps anyone else, the answer was:

I had forgotten to provide a link to JQuery in my <head> tag:

 

Also I changed the ReportViewer tag to this one:

<telerik:ReportViewer
            ID="reportViewer1"
            Width="1300px"
            Height="900px"
            runat="server">
            <ReportSource IdentifierType="UriReportSource" Identifier="ConsignmentProductReport.trdp">
            </ReportSource>
            <%-- If set to true shows the Send Mail Message toolbar button --%>
            <SendEmail Enabled = "false" />
        </telerik:ReportViewer>

 

And the report renders perfectly, complete with parameterised data.

0
John
Top achievements
Rank 1
answered on 19 Dec 2018, 01:09 PM

I had the same problem but I wasn't using .trdp files. I don't know if you found my post about it but It might help you in the future if you want to use the Visual Studio Reports with the HTML5 viewer.

https://www.telerik.com/forums/passing-url-parameters-to-your-report---how-to 

0
Stuart
Top achievements
Rank 1
answered on 19 Dec 2018, 02:09 PM

Hi John

I didn't come across your post unfortunately, but thanks for sharing.  I looked at so many my head was spinning.  Love the functionality of Telerik tools but the learning curve sure does seem steep...

0
Silviya
Telerik team
answered on 21 Dec 2018, 01:16 PM
Hello Stuart,

Based on the posts so far, I assume that you've already managed to solve the problem by yourself. Good job!
Also, I want to thank you for your feedback!  We are always trying to improve our documentation articles, so it will be really helpful if you point us to the articles that cause confusion and do not explain the subject in a clear and concise way. Our articles are being constantly changed due to adding new features, but we will also edit and refine them if it will contribute to a better documentation.

As a side note, if the current subscription allows, you can open a support ticket. The ticket would guarantee you 24h response time (if it's not Lite support), while the forum posts are usually answered within 72h, but there is no guarantee that there would be an answer.

Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Stuart
Top achievements
Rank 1
Answers by
Stuart
Top achievements
Rank 1
John
Top achievements
Rank 1
Silviya
Telerik team
Share this question
or