Telerik Forums
Reporting Forum
1 answer
121 views
@(Html.TelerikReporting().ReportViewer()
     // Each report viewer must have an id - it will be used by the initialization script
     // to find the element and initialize the report viewer.
     .Id("reportViewer1")
     // The URL of the service which will serve reports.
     // The URL corresponds to the name of the controller class (ReportsController).
     // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
     .ServiceUrl(Url.Content("~/api/reports"))
     // The URL for custom report viewer template. The template can be edited -
     // new functionalities can be added and unneeded ones can be removed.
     // .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-11.0.17.406.html"))
     // Strongly typed ReportSource - TypeReportSource or UriReportSource.
     .ReportSource(new TypeReportSource() { TypeName = "WebApplication2.Report.Report1, WebApplication2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" })
     // Specifies whether the viewer is in interactive or print preview mode.
     // PrintPreview - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
     // Interactive - Displays the report in its original width and height with no paging. Additionally interactivity is enabled.
     .ViewMode(ViewMode.Interactive)
     // Sets the scale mode of the viewer.
     // Three modes exist currently:
     // FitPage - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
     // FitPageWidth - The report will be zoomed in or out so that the width of the screen and the width of the report match.
     // Specific - Uses the scale to zoom in and out the report.
     .ScaleMode(ScaleMode.Specific)
     // Zoom in and out the report using the scale
     // 1.0 is equal to 100%, i.e. the original size of the report
     .Scale(1.0)
     // Sets whether the viewer’s client session to be persisted between the page’s refreshes(ex. postback).
     // The session is stored in the browser’s sessionStorage and is available for the duration of the page session.
     .PersistSession(false)
     // Sets the print mode of the viewer.
     .PrintMode(PrintMode.AutoSelect)
     .ClientEvents(
             events => events
             .PrintBegin("PrintRepo")
                                     )
 )

 

 

 

using above code to host report in .cshtml 

I need to access client side api in javascript. 

var viewer = <%=ReportViewer1.ClientID%> // Not able to access reportViewer object in .cshtml

  <script type="text/javascript">
        function PrintRepo() {
           PrintDocument(); //if I get the access of reportViewer, then I can use PrintDocument() function
        }
    </script>

Any help is appreciated. Thanks 

 

Katia
Telerik team
 answered on 08 Jun 2017
5 answers
786 views

I have multiple reports created in Report Designer with the same error condition.  Each has one or more report parameters that have an entity datasource (sql server stored procedure) and set to multivalue=true and set to null=yes and have no initial value set.  These are passed as arguments to the stored procedure for the main datasource.  Having no selections is a valid condition.

When run through our web application, when the report initially displays each of those multi-select parameters it displays the "Please input a valid value" error message.  Usually when this happens, the report engine pauses, additionally displays the "Please input valid data for all parameters" message as well, then waits for more user input.

However this is not happening:  the "Please input..." message is not being displayed, and the report jumps right in and does an initial rendering to the web page.  This indicates it thinks it does not have any invalid parameters.  Yet, the Preview button is not clickable indicating it thinks there are invalid parameters.  Very confusing.

The work-arounds include:

1) Select one item in the parameter list, then un-select it.  Now the Preview button works.

2) In report designer, force an initial selection of one item in the report parameter.

3) In report designer, change the report parameter to be single value instead of multi value.

4) In report designer, run the report in preview mode - it runs fine with no error messages.

None of these are good solutions of course.  So I need to know how to suppress the seemingly erroneous parameter errors.

Telerik 11.0.17.118  Windows 10 VS 2015 SQL Server 2016.  This happens when running locally through VS as well as when deployed to a separate server.

Thanks.

Stef
Telerik team
 answered on 08 Jun 2017
1 answer
126 views

I need to create a graph with a huge information everyday (data created every 5 seconds). The problem is, there is too many record rendered on the graph and it's hard to see (as image attached below). Is there any possible way to group the x-axis (datetime) to show as interval for every hour and every record still plot on the graph.

 

Thank you.

Stef
Telerik team
 answered on 06 Jun 2017
3 answers
1.0K+ views

I have a main report having subreport whose reportsource has to be set dynamically based on the field value (Response type) of the sqldatasource of mainreport ,
I tried to get the value of Responsetype from the dataobject in detail_itemdatabinding event and stored in a variable .
I subreport_itendataBinding event tried to set Telerik.Reporting.SubReport.reportsource to new object of TypeReportSource class, then invalidcastexception is ocurring
Unable to cast object of type 'Telerik.Reporting.Processing.SubReport' to type 'Telerik.Reporting.SubReport
'Telerik.Reporting.Processing.SubReport does not have REportsource property so i used Telerik.Reporting.SubReport, but exception is happening

Kindly assist on this issue

 public partial class InterviewReport : Telerik.Reporting.Report
    {
        protected string reportSourceValue = "";
        public InterviewReport()
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        private void detail_ItemDataBinding(object sender, System.EventArgs e)
        {
            Telerik.Reporting.Processing.DetailSection item =
                (Telerik.Reporting.Processing.DetailSection)sender;
         
            object o = item.DataObject["ResponseType"];
            if (o is string)
            {
                if (string.Equals(o, "Text Response"))
                {
                    this.reportSourceValue = "ReportLibrary.Reports.Response, ReportLibrary, Version=1.0.0.0, Culture=neutral, " +
     "PublicKeyToken=null";
                }
                else if (string.Equals(o, "Check Box"))
                {
                    this.reportSourceValue = "ReportLibrary.Reports.ReportCheckBox, ReportLibrary, Version=1.0.0.0, Culture=neutral, " +
      "PublicKeyToken=null";
                }
            }
        }

        private void subReport1_ItemDataBound(object sender, System.EventArgs e)
        {
            // Telerik.Reporting.Processing.ReportItemBase item =
            // (Telerik.Reporting.Processing.ReportItemBase)sender;
            Telerik.Reporting.SubReport sub = (Telerik.Reporting.SubReport)sender;

            Telerik.Reporting.TypeReportSource typeReportSource2 = new Telerik.Reporting.TypeReportSource();
            typeReportSource2.Parameters.Add(new Telerik.Reporting.Parameter("LocalEngID", "= Parameters.LocalEngID.Value"));
            typeReportSource2.Parameters.Add(new Telerik.Reporting.Parameter("InterviewQuestionsID", "=Fields.InterviewQuestionsID"));
            typeReportSource2.TypeName = reportSourceValue;
            sub.ReportSource = typeReportSource2;
        }

    }

 

Regards,

Mary Jain

Ian
Top achievements
Rank 1
 answered on 06 Jun 2017
5 answers
604 views
I'm using Q2 2012 of Telerik reporting. I need to use the NeedDataSource event to populate my subreports. My subreports are populated by objects that inherit Reporting.Report. When I run the report, I get this error

An error has occurred while processsing Report 'Group' (my object)
An error has occurred while resolving  '' data source: Object reference not set to an instance of an object.

this is my needDataSource
protected void needDataSource(object sender, EventArgs e)
            {
                Telerik.Reporting.Processing.ReportItemBase subreport = sender as Telerik.Reporting.Processing.ReportItemBase;
                if (this.DataSource != null)
                {
                    ods = new ObjectDataSource();
                    ods.DataSource = this.DataSource;
                    ods.DataMember = groupid;
                    ods.Parameters.Add(new ObjectDataSourceParameter(groupid));
                    subreport.Report.DataSource = ods;
                }              
            }

Thanks in advance!
Gersh
Stef
Telerik team
 answered on 05 Jun 2017
3 answers
1.1K+ views

Greetings!  

I need help with receiving parameters from a report. The following code allows me to alter the DataSource of such Report, however I still need to intercept and alter the parameters used on that report.

 

01.public Telerik.Reporting.ReportSource Resolve(string report)
02.    {
03.        ReportSource reportInstance;
04.         
05.        //retrieve an instance of the report
06.        var connectionString = "Data Source=OurServer;Initial Catalog=OurDataBase;User ID=xxxxxxxx;xxxxxxx;";
07.        ReportConnectionStringManager csm = new ReportConnectionStringManager(connectionString);
08. 
09.        var appPath = HttpContext.Current.Server.MapPath("~/");
10.        var reportsPath = Path.Combine(appPath, "Reports");
11.        var uri = Path.Combine(reportsPath, report);
12. 
13.        var sourceReportSource = new UriReportSource() { Uri = uri };
14. 
15.        reportInstance = csm.UpdateReportSource(sourceReportSource);
16. 
17.        return reportInstance;
18.    }

Is it possible to receive and modify parameters from the report call utilizing HttpContext.Current ?  Or is there a Telerik Class/Method that allows me to do so?

Thanks in advance! Best Regards. 

Stef
Telerik team
 answered on 05 Jun 2017
3 answers
165 views
An have an MVC app with a report viewer control that displays a report. The report has links in it that navigate to another report. The parameters are the same for both reports with the exception of one additional parameter for the drillthrough. I am programatically passing the parameters to the parent report from my MVC app. I want the user to be able to modify the parameter selection and refresh the drillthough report without having to go back to the parent report. Is this possible? 
Stef
Telerik team
 answered on 05 Jun 2017
1 answer
73 views

I'm developing a WPF application, using Visual Studio 2017 Community and SQL Server 2.016. The version of the report generator is R2 2017 11.1.17.503

The strange thing is that the data appears when the DataSource is configured. However, when you run Preview, the detail line data is invisible.

My stored procedure uses a temporary table and creates the SQL command dynamically.

Could someone please help?

Katia
Telerik team
 answered on 05 Jun 2017
1 answer
514 views
I can't seem drag and drop the columns. Are there other alternatives to reordering existing columns at design-time?
Stef
Telerik team
 answered on 02 Jun 2017
2 answers
706 views
Hi,

In the footer part of my report page, I want to show print date and time the format of the datetime will be YYYY-MM-DD HH:mm PM, I will to regulate the format using the Format property in the property window.  I just can not figure out how to show AM or PM accordingly.  Can you give me the format mask, or could you give me a list of format mask I can use for future reference?

Thanks,

enrique
Top achievements
Rank 1
 answered on 01 Jun 2017
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?