Telerik Forums
Reporting Forum
1 answer
84 views
Hi

I am using Telerik Reporting  Q3 2011

On browser versions earlier than firefox 30,Chrome 35.0  and IE 11 the print button works fine on Firefox 30. now when i click the print button the page refreshes and nothing happens, same with IE11, on chrome i get an error message "Unable to perform print operation" is there any way i can resolve this issue?
Stef
Telerik team
 answered on 14 Jul 2014
1 answer
96 views
im new in telerik report. my project is, i want webapi call Report Library that i created using telerik VS report designer). after follow the demo, i success for calling standalone report. but now i want to call from report library

.here is my code

in view
@( Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
 .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
.ReportSource(new UriReportSource() { Uri = "User.trdx" })
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0) )


in web api
public class Reports1Controller : ReportsControllerBase
{
    protected override IReportResolver CreateReportResolver()
    {
        var appPath = HttpContext.Current.Server.MapPath("~/Reports");
 
        return new ReportFileResolver(appPath)
            .AddFallbackResolver(new ReportTypeResolver());
    }
 
    protected override ICache CreateCache()
    {
        return CacheFactory.CreateFileCache();
    }
}

i have create a Project for ReportLibrary and class UserReport.cs using VS ReportDesigner. i need to call UserReport in WebApi or View? and how to call?

firstly i need to change

.ReportSource(new UriReportSource() { Uri = "User.trdx" }

to 
.ReportSource(new TypeReportSource() { TypeName ="Class1.User, Class" })

how about in ReportsController?

i no need to use ReportFileResolver right?

thank you so much
Nasko
Telerik team
 answered on 11 Jul 2014
1 answer
192 views
I've recently began updating one of our projects from Reporting Q1 2013 (7.2.14.127) to Q2 2014 (8.1.14.618), but have ran into the problem of trying to pass a model to an objectdatasource.  Previously, I used 8 Easy Steps to display the ReportViewer using .aspx and would use an InstanceReportSource to render the report:

aspx View
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<MyProject.Models.MyModel>" %>
 
protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        var instanceReportSource = new InstanceReportSource();
  
        Report report = new Report1(Model);
  
        instanceReportSource.ReportDocument = report;
  
        ReportViewer1.ReportSource = instanceReportSource;
        ReportViewer1.ViewMode = ViewMode.Interactive;
    }

Report class:
using MyProject.Models;
 
namespace Admissions.Reports
{
    using Telerik.Reporting;
  
    public partial class Report1 : Report
    {
        public Report1()
        {
            InitializeComponent();
        }
  
        public Report1(MyModel model) : this()
        {
            DataSource = model;
        }
    }
}

With the new version of Telerik Reporting, InstanceReportSource is obsolete when using the new razor syntax to generate the report so we
have to use UriReportSource or TypeReportSource.
I've tried to use a custom report resolver (example at bottom of OP (Missing Report Name), and was able to pass data in using InstanceReportSource, but I wasn't able to attach any report parameters since the Model is being populated inside of the resolver (which I'd prefer not to do) and the report is created in the resolver and not actually using any parameters from the view.

.cshtml view
@{
    var uriRS = new UriReportSource() { Uri = "1"};
}
@(
Html.TelerikReporting().ReportViewer().Id("reportViewer1")
   .ServiceUrl("/api/reports/")
   .TemplateUrl("/Content/ReportViewer/templates/telerikReportViewerTemplate.html")
        .ReportSource(uriRS)
        .ViewMode(ViewModes.INTERACTIVE)
        .ScaleMode(ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(false)
      )

Report Resolver
namespace Admissions.Controllers
{
    public class ReportsController : ReportsControllerBase
    {
        protected override ICache CreateCache()
        {
            return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
        }
  
        protected override IReportResolver CreateReportResolver()
        {
            return new CustomReportResolver();
        }
    }
  
    public class CustomReportResolver : IReportResolver
    {
        public ReportSource Resolve(string reportId)
        {
            var report = new Report();
  
            report = new Report1(new DashboardViewModel { TotalRolesCount = "Hello Report World" });
  
            var irs = new InstanceReportSource { ReportDocument = report };
  
            return irs;
        }
    }
}

Has anyone found a way to pass the Model directly into the report, (var report = new Report1(Model) ); or a solution that would work equally well?
Stef
Telerik team
 answered on 11 Jul 2014
4 answers
560 views
Hi, I am using Telerik Reporting Q3 2013, and am trying to create a view model in an MVC application to display a report.  I am having an issue using the InstanceReportSource.

This works fine, and the report is displayed as expected (where "Report" in '_model.Report' is a custom class I have created to represent a report, and the parameters I enumerate are also custom classes that represent a report parameter in my report class, where the 'Value' property is a C# dynamic)....
                       
public ReportSource ReportSource
{
    get
    {
        // create the report source for the report
        var reportSource = new TypeReportSource
        {
            TypeName = _model.Report.TypeName + ", " + _model.Report.AssemblyName
        };
  
        // add all report parameters
        foreach (var parameter in _model.Parameters)
        {
            reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
        }
 
        // set a title parameter to the title of the user's report
        reportSource.Parameters.Add("Title", _model.Title);
 
        return reportSource;
    }
}

However, if I switch to using an InstanceReportSource, the report viewer just shows a "bad request" error...
public ReportSource ReportSource
        {
            get
            {
                // create the report source for the report
                var reportSource = new InstanceReportSource
                {
                    ReportDocument = new BidTabReportByStatus()
                };
 
                // add all report parameters
                foreach (var parameter in _model.Parameters)
                {
                    reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
                }
 
                // set a title parameter to the title of the user's report
                reportSource.Parameters.Add("Title", _model.Title);
 
                return reportSource;
            }
        }

In both cases, my view simply loads the report source property from the model...

@{
    // display the report
    @(Html.TelerikReporting().ReportViewer()
          .Id("reportViewer")
          .ServiceUrl("/api/reports/")
          .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
          .ReportSource(Model.ReportSource)
          .ViewMode(ViewModes.INTERACTIVE)
          .ScaleMode(ScaleModes.SPECIFIC)
          .Scale(1.0)
          .PersistSession(false))
}

Can you please help me figure out what is going on?  My ultimate goal is to be able to use one report for multiple data sets, by defining a sql command for the report's SqlDataSource 's CommandText property by defining it on the report source, which I can obtain using the instance report source.

Thanks,
Andy
Stef
Telerik team
 answered on 11 Jul 2014
3 answers
295 views
I'm trying to create a simple report with telerik reporting and ASP.NET MVC 4. I have several questions

I have created a sample report by binding to a sql datasource.

my report name is "Report2.cs" but i'm confused about .trdx report (why should i create a .trdx report)?

when trying to bind  the report to report viewer i use the below code.

@{
    ViewBag.Title = "reportview";
    Layout = "~/Views/Shared/_mainView.cshtml";
}

@section styles
{

    <link href="~/Content/ReportViewer/styles/ReportViewer-7.2.13.1016.css" rel="stylesheet" />
    <style>
        #reportViewer1
        {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 5px;
            bottom: 5px;
            overflow: hidden;
        }
    </style>
}

@section scripts
{
    <link href="~/Content/kendo/2013.2.716/kendo.common.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2013.2.716/kendo.blueopal.min.css" rel="stylesheet" />
    <script src="~/Scripts/kendo/2013.2.716/kendo.all.min.js"></script>

    <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
    <script src="~/Content/ReportViewer/js/ReportViewer-7.2.13.1016.js"></script>
    
}

@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        .TemplateUrl("/Content/ReportViewer/templates/telerikReportViewerTemplate.html")
        .ReportSource(new Telerik.Reporting.TypeReportSource() { TypeName = "MvcReportApplication.MyReport.Report2" })
        .ViewMode(Telerik.ReportViewer.Mvc.ViewModes.INTERACTIVE)
        .ScaleMode(Telerik.ReportViewer.Mvc.ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(true)
)

report is not displayed and i get the below error in console

Uncaught TypeError: Cannot call method 'replace' of undefined

Stef
Telerik team
 answered on 11 Jul 2014
2 answers
321 views
I have an MVC4 web application with Razor pages.  The report page uses a UriReportSource for the Telerik ReportViewer.
The cshtml code is:

@model StdPOTOrderPrint
 
 
@{
    var uriRS = new UriReportSource() { Uri = @Model.ReportParms };
}
 
 
@(Html.TelerikReporting().ReportViewer()
    .Id("reportViewer1")
        .ServiceUrl(Url.Content("~/api/reports/"))
        .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate.html"))
        .ReportSource(uriRS)
        .ViewMode(ViewModes.INTERACTIVE)
        .ScaleMode(ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(false)
 
)

 The controller code is:
 
namespace CPR.WebPortal.Controllers
{
    public class ReportsController : ReportsControllerBase
    {
 
        protected override IReportResolver CreateReportResolver()
        {
            return new CustomReportResolver();
        }
 
        protected override ICache CreateCache()
        {
            return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
        }
    }
 
    public class CustomReportResolver : IReportResolver
    {
 
        public Telerik.Reporting.ReportSource Resolve(string reportparms)
        {
            string[] stringSeparators = new string[] {"|"};
            string[] sarray = reportparms.Split(stringSeparators, StringSplitOptions.None);
 
            long patientid = Convert.ToInt64(sarray[0]);
            long orderid = Convert.ToInt64(sarray[1]);
 
            ....
 
            PatientPhysicianOrderStandardPropertyBag orderBag = new PatientPhysicianOrderStandardPropertyBag();
            PatientHelper.Populate(order, orderBag);
 
            PatientPhysicianOrderStandardDataObject _dataSource = new PatientPhysicianOrderStandardDataObject(workContext, orderBag);
 
            Telerik.Reporting.Report report = new DHS.Client.Controllers.Reporting.ReportDefinitions.PatientPhysicianOrderStandardReport();
            report.DataSource = orderBag;
 
            Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
            irs.ReportDocument = report;
 
            return irs;
        }
    }
}

 The problem is that the  Resolve method is not being called, resulting in the reportviewer showing an error of:
 
Unable toget report parameters:
Report '500507|500029' cannot be resolved.

Why is Resolve not being called?
Dan
Dan
Top achievements
Rank 2
 answered on 10 Jul 2014
3 answers
146 views
Hi,

configurable parameters in telerik reporting is a great feature which saves me a lot of time in allowing to avoid coding my own solution.
Actually, when defining a parameter with AllowNull = true on a drop down or date field a checkbox "NULL" apperas near the field. I would rather prefer to have something like "Please select" to be treated as null value on drop downs or nothing entered in the date boxes.

Is there a way to achieve this behavior in telerik reporting?

Regards
Stef
Telerik team
 answered on 10 Jul 2014
1 answer
517 views
Hi

I currently have a report which i created which looks good.

I have a sub report in the report which show a order sent to supplier

I need to add a second page which shows a distribution list but this needs to start on a new page as it has a different layout.
How could i do this
Nasko
Telerik team
 answered on 10 Jul 2014
1 answer
394 views
Hi

I currently have a textbox that calculates the total of two fields
textbox1 =(Fields.qty * Fields.cost)

i want to add a textbox at the end of the group to calculate the sum of textbox1
I have tried

textbox2 = Sum(Textbox1) but i am getting the following error
"An error has occured whil processing 'report1'. the expression contains object 'textbox1'that is not defined in the current context"
Nasko
Telerik team
 answered on 10 Jul 2014
1 answer
119 views
Hi,
      My Report select statement contains the following columns, Pickup time,Enroute,scene,Transport,Destination,Available..
     The Report also showing the same results. But When I export to CSV  it will be showing the following order Pickup time,Transport,Enroute,Destination,Available,
     scene.

     Anybody please suggest a solution for fix this issue...

     Hope u r valuable suggessions...

    Regards
    Manu Vijayan
Stef
Telerik team
 answered on 10 Jul 2014
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?