Telerik Forums
Reporting Forum
6 answers
388 views
Hi,

I am developing some mvc5 application. I am stuck in telerik report viewer. kindly see my code and suggest where is the issue please.
ReportViewerView1.cshtml where as  the productcatalog is the report which i am binding to this report viewer using TypeReportSource

001.@using Telerik.Reporting
002.@using Telerik.ReportViewer.Mvc
003.@{
004.    ViewBag.Title = "Telerik MVC HTML5 Report Viewer";
005.}
006. 
007.@section styles
008.{
010. 
011.    <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.common.min.css" rel="stylesheet" />
012.    <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.blueopal.min.css" rel="stylesheet" />
013. 
014. 
015.    <style>
016.        #reportViewer1 {
017.            position: absolute;
018.            left: 5px;
019.            right: 5px;
020.            top: 5px;
021.            bottom: 5px;
022.            overflow: hidden;
023.            font-family: Verdana, Arial;
024.        }
025.    </style>
026. 
027.    <link href="@Url.Content("~/ReportViewer/styles/telerikReportViewer-9.1.15.731.css")" rel="stylesheet" />
028.}
029. 
030.@(Html.TelerikReporting().ReportViewer()
031.        // Each report viewer must have an id - it will be used by the initialization script
032.        // to find the element and initialize the report viewer.
033.        .Id("reportViewer1")
034.        // The URL of the service which will serve reports.
035.        // The URL corresponds to the name of the controller class (ReportsController).
036.        // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
037.        .ServiceUrl(Url.Content("~/api/reports/"))
038.        // The URL for the report viewer template. The template can be edited -
039.        // new functionalities can be added and unneeded ones can be removed.
040.        // For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
041.        .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-9.1.15.731.html"))
042.        // Strongly typed ReportSource - TypeReportSource or UriReportSource.
043.        .ReportSource(new TypeReportSource() { TypeName = "Telerik.Reporting.Examples.CSharp.ProductCatalog, DubaiFleet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" })
044.        // Specifies whether the viewer is in interactive or print preview mode.
045.        // PrintPreview - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
046.        // Interactive - Displays the report in its original width and height with no paging. Additionally interactivity is enabled.
047.        .ViewMode(ViewMode.Interactive)
048.        // Sets the scale mode of the viewer.
049.        // Three modes exist currently:
050.        // FitPage - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
051.        // FitPageWidth - The report will be zoomed in or out so that the width of the screen and the width of the report match.
052.        // Specific - Uses the scale to zoom in and out the report.
053.        .ScaleMode(ScaleMode.Specific)
054.        // Zoom in and out the report using the scale
055.        // 1.0 is equal to 100%, i.e. the original size of the report
056.        .Scale(1.0)
057.        // Sets whether the viewer’s client session to be persisted between the page’s refreshes(ex. postback).
058.        // The session is stored in the browser’s sessionStorage and is available for the duration of the page session.
059.        .PersistSession(false)
060.        // Sets the print mode of the viewer.
061.        .PrintMode(PrintMode.AutoSelect)
062.        // Defers the script initialization statement. Check the scripts section below -
063.        // each deferred script will be rendered at the place of TelerikReporting().DeferredScripts().
064.        .Deferred()
065.        .ClientEvents(
066.                events => events
067.                    .RenderingBegin("onRenderingBegin")
068.                    .RenderingEnd("onRenderingEnd")
069.                    .PrintBegin("onPrintBegin")
070.                    .PrintEnd("onPrintEnd")
071.                    .ExportBegin("onExportBegin")
072.                    .ExportEnd("onExportBegin")
073.                    .UpdateUi("onUpdateUi")
074.                    .PageReady("onPageReady")
075.                    .Error("onError")
076.                    )
077.        // Uncomment the code below to see the custom parameter editors in action
078.        //.ParameterEditors(
079.        //        editors => editors
080.        //            .SingleSelectEditor("createSingleSelectEditor")
081.        //            .CustomEditors(new CustomParameterEditor
082.        //            {
083.        //                MatchFunction = "customMatch",
084.        //                CreateEditorFunction = "createCustomEditor"
085.        //            })
086.        //)
087.)
088. 
089.@section scripts
090.{
091.    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer-9.1.15.731.min.js")"></script>
092. 
093.    <!--kendo.all.min.js can be used as well instead of kendo.web.min.js and kendo.mobile.min.js-->
095.    <!--kendo.mobile.min.js - optional, if gestures/touch support is required-->
097. 
098. 
099.    <script>
100.        function onRenderingBegin() {
101.            console.log("rendering begin!");
102.        }
103.        function onRenderingEnd() {
104.            console.log("rendering end!");
105.        }
106.        function onPrintBegin() {
107.            console.log("print begin!");
108.        }
109.        function onPrintEnd() {
110.            console.log("print end!");
111.        }
112.        function onExportBegin() {
113.            console.log("export begin!");
114.        }
115.        function onExportEnd() {
116.            console.log("export end!");
117.        }
118.        function onUpdateUi() {
119.            console.log("update ui!");
120.        }
121.        function onError() {
122.            console.log("error!");
123.        }
124.        function onPageReady() {
125.            console.log("page ready!");
126.        }
127. 
128.        function createSingleSelectEditor(placeholder, options) {
129.            var dropDownElement = $(placeholder).html('<div></div>');
130.            var parameter,
131.                  valueChangedCallback = options.parameterChanged,
132.                  dropDownList;
133. 
134.            function onChange() {
135.                var val = dropDownList.value();
136.                valueChangedCallback(parameter, val);
137.            }
138. 
139.            return {
140.                beginEdit: function (param) {
141. 
142.                    parameter = param;
143. 
144.                    $(dropDownElement).kendoDropDownList({
145.                        dataTextField: "name",
146.                        dataValueField: "value",
147.                        value: parameter.value,
148.                        dataSource: parameter.availableValues,
149.                        change: onChange
150.                    });
151. 
152.                    dropDownList = $(dropDownElement).data("kendoDropDownList");
153.                }
154.            };
155.        }
156. 
157.        function customMatch(parameter) {
158.            return Boolean(parameter.availableValues)
159.                && !parameter.multivalue
160.                && parameter.type === telerikReportViewer.ParameterTypes.BOOLEAN;
161.        }
162. 
163.        function createCustomEditor(placeholder, options) {
164.            var dropDownElement = $(placeholder).html('<div></div>');
165.            var parameter,
166.                  valueChangedCallback = options.parameterChanged,
167.                  dropDownList;
168. 
169.            function onChange() {
170.                var val = dropDownList.value();
171.                valueChangedCallback(parameter, val);
172.            }
173. 
174.            return {
175.                beginEdit: function (param) {
176. 
177.                    parameter = param;
178. 
179.                    $(dropDownElement).kendoDropDownList({
180.                        dataTextField: "name",
181.                        dataValueField: "value",
182.                        value: parameter.value,
183.                        dataSource: parameter.availableValues,
184.                        change: onChange
185.                    });
186. 
187.                    dropDownList = $(dropDownElement).data("kendoDropDownList");
188.                }
189.            };
190.        }
191.    </script>
192. 
193.    @(
194. 
195.        // All deferred initialization statements will be rendered here
196.        Html.TelerikReporting().DeferredScripts()
197.    )
198.}


 Controller for reportviewer
01.namespace DubaiFleet.Views.ReportsMain.Controllers
02.{
03.    using System.IO;
04.    using System.Web;
05.    using Telerik.Reporting.Cache.File;
06.    using Telerik.Reporting.Services;
07.    using Telerik.Reporting.Services.WebApi;
08.
09.    //The class name determines the service URL.
10.    //ReportsController class name defines /api/report/ service URL.
11.    public class ReportsController : ReportsControllerBase
12.    {
13.        static ReportServiceConfiguration configurationInstance;
14.
15.        static ReportsController()
16.        {
17.            //This is the folder that contains the XML (trdx) report definitions
18.            //In this case this is the app folder
19.            var reportsPath = HttpContext.Current.Server.MapPath("~/");
20.
21.            //Add resolver for trdx report definitions,
22.            //then add resolver for class report definitions as fallback resolver;
23.            //finally create the resolver and use it in the ReportServiceConfiguration instance.
24.            var resolver = new ReportFileResolver(reportsPath)
25.                .AddFallbackResolver(new ReportTypeResolver());
26.
27.            //Setup the ReportServiceConfiguration
28.            configurationInstance = new ReportServiceConfiguration
29.            {
30.                HostAppId = "Html5App",
31.                Storage = new FileStorage(),
32.                ReportResolver = resolver,
33.                // ReportSharingTimeout = 0,
34.                // ClientSessionTimeout = 15,
35.            };
36.        }
37.
38.        public ReportsController()
39.        {
40.            //Initialize the service configuration
41.            this.ReportServiceConfiguration = configurationInstance;
42.        }
43.    }
44.}

kindly suggest me accordingly. I am using reportviewerview1.cshtml as partialview in my own page.

Regards,

Faisal
Nasko
Telerik team
 answered on 05 Nov 2015
1 answer
65 views

HI,

i have a problem that i can't solve. i have a telerik report. in details section i have a table that bund to data source, and after it i have a repeated list (that bound to another property in data source).

the problem is, that when item in list (such as textbox) wich contain long text above one page (on Pdf design), it break the page between the table outsize the list and the first item in list.

how can i minimize the space?

i need it urgently.

Thanks,

ChavK.

Nasko
Telerik team
 answered on 05 Nov 2015
3 answers
204 views

Greetings,

 

I need your help with the below issue.

 

I'm streaming an exported PDF from a telerik report and I need to insert JavaScript to be executed after acrobat event 'DidPrint' which I want to execute to close the PDF file after the filed being printed.

 Below is how I render the report as PDF and print it sielently.

 

       deviceInfo["JavaScript"] = "this.print({bUI: false, bSilent: false, bShrinkToFit: true});";
            var reportProcessor = new ReportProcessor();
            var reportSource = new Telerik.Reporting.InstanceReportSource();
            Report1 report = new Report1();
            report.ReportParameters["ID"].Value = "10";
            reportSource.ReportDocument = report;
            var renderingResult = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);

Stef
Telerik team
 answered on 04 Nov 2015
2 answers
66 views
Hi. 

I'm trying to display the subtotal of fields.amount to page footer using the PageExec Function, 
but it doesn't show on the report viewer even I switch it into print view. [Please find attachment below.


I wonder if someone can help me with this? 



PS:
I'm using Telerik Reporting Q2 2015 SP1.
Von Aaron
Top achievements
Rank 2
 answered on 04 Nov 2015
7 answers
274 views
We are binding our reports through the code-behind.  I need to create a drillthrough report.  I have watched the video, and set up the Master report action correctly -- I selected the child report using the "Select Report Document" and I created the target report parameter. On the Child Report, I have created the parameter to match the one specified within the master.

However, on my child report, I cannot figure out how to access this parameter. It is not being passed into the constructor (get an error if I force the constructor to accept a parameter) and the "Load" and "Init" events of the child report do not fire.  The value of the Report.Parameter I have defined is null.

How can I access this passed-in parameter value?
Stef
Telerik team
 answered on 03 Nov 2015
6 answers
350 views
Hello

We are working on optimizing our reports, and after some investigation it turns out, reports with more than 1000 rows take too long to render.



We have modified our queries so fetching the data is actually neglectible compared to the actual rendering time. Both Excel and CSV produce very similar results, so it cannot be due to some formatting issue. There isn't any conditional formatting applied to the reports there is only a table with 14 columns in the details section.
The computer specs I'm testing it on: Core i5 3.2 GHz, 8GB RAM, 240 GB SSD.

I know that similar thread exist, but I've read in the release notes that rendering performance has been significantly improved in this version, so that's why I'm puzzled.

Regards,
Roland

















Rows
SQL Time (ms)
Linq time (ms)
GetData Total (ms)
Render (ms)


2000
1
16
95
3567


4000
1
24
105
13905


8000
1
39
122
51170







%��:�
Stef
Telerik team
 answered on 03 Nov 2015
1 answer
255 views

Hi i'm trying to generate the pie Chart attached in the file ...

I have a SQL source with this 3 columns:

Category  ---- Sector .....  Numofitems

C1                     A                 125

C1                     B                 175

C2                     F                 200

C1                     N                 135

I need a pie than first made the groupby Category -- num of ítems and their % so in the legend only have 2 categories in this case.

and the in this category made the groupby Sector -- num of ítems and their %

 

But I can not know how first group by Category and then by sector with the telerik report Designer ...

I hope looking the file attached you will see what i need ...

 

Thanks,

 

Joan

 

Stef
Telerik team
 answered on 03 Nov 2015
5 answers
223 views
Hi All,

I am trying to create a drill through report in a new window in a winforms application.  I know that I can set up a drill through to the same report viewer, but often the users like to see both the original report and any sub-reports side by side.  Is there a way to get the field name and value and perhaps other data for the same row in a VB or C# program when a user clicks or double clicks on a data item?  I could then use that data to create the other report.  Alternatively, is there a way to use the drill through action to create a spawned report in its own window?

Thanks in advance for any help.

Stef
Telerik team
 answered on 30 Oct 2015
1 answer
152 views

Hello,

I need to set scale unit and/or step properties based on expressions for datetime scale. The reason for this is because my charts' time axis (x-axis) vary based on report input parameters (from date and to date).

Moreover, axis labels and grid lines should be able to dynamically reflect a timespan of an hour as well as a timespan of several months. 

Doing this programmatically is currently not an option. Are there any ways to achieve the above in Telerik Report Designer?

 

 

Nasko
Telerik team
 answered on 30 Oct 2015
1 answer
236 views

Hi,

 

I want to hide header and footer of main report, in subreport.

Ignore header and footer of main report, in some of sub reports.

Nasko
Telerik team
 answered on 30 Oct 2015
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?