Telerik Forums
Reporting Forum
3 answers
446 views
I am trying to change the connection string of a UriReportSource at runtime in an MVC 4 application.  I am using this page as a guide:

http://www.telerik.com/support/kb/reporting/details/changing-the-connection-string-dynamically-according-to-runtime-data

However I end up getting this error: "Unable to get report parameters: Missing report name"

Here is the ReportsController:

public class ReportsController : ReportsControllerBase
{
    protected override IReportResolver CreateReportResolver()
    {
 
        var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");
 
        return new ReportFileResolver(reportsPath)
            .AddFallbackResolver(new ReportTypeResolver());
        //return new CustomReportResolver();
    }
 
    protected override ICache CreateCache()
    {
        return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
    }
}

Code for the controller for the view containing the ReportViewer:

public ActionResult Index()
{
    string connectionString = GetConnectionString();
    ReportConnectionStringManager connStringManager = new ReportConnectionStringManager(connectionString);
    string uri = Server.MapPath("/Reports/Tickets2.trdx");
    UriReportSource theReport = new UriReportSource() { Uri = uri };
    InstanceReportSource fixedReport = connStringManager.UpdateReportSource(theReport);
    return View(new ReportModel() { TheReport = fixedReport });
}
 (Note that ReportModel.TheReport is of type InstanceReport)

And the View:

@model FastTrack.MVC.Models.ReportModel
@{
    ViewBag.Title = "Reports";
}
 
@section styles
{      
    <link href="ReportViewer/styles/telerikReportViewer-8.1.14.618.css" rel="stylesheet" />
<style>
        #reportViewer1 {
            position: relative;
            width: 100%;
            height: 1000px;
            font-family: 'segoe ui', 'ms sans serif';
            overflow: hidden;
        }
    </style>
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
}
 
@section scripts
{
    <script src="ReportViewer/js/telerikReportViewer-8.1.14.618.js"></script>
}
<div class="container">
<div class="row">
            @(Html.TelerikReporting().ReportViewer()
                   .Id("reportViewer1")
                   .ServiceUrl("/api/reports/")
                   .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.618.html")
                   .ReportSource(@Model.TheReport)
                   .ViewMode(ViewModes.INTERACTIVE)
                   .ScaleMode(ScaleModes.SPECIFIC)
                   .Scale(1.0)
                   .PersistSession(false)
                   )
 
    </div>
    </div>

I have verified that passing the reportviewer is working when simply passing the report in as a Uri, but we have to be able to change the connection string dynamically because or data/connections are tenant-based.

Any help is appreciated
Stef
Telerik team
 answered on 12 Jan 2015
12 answers
2.0K+ views
I have a report where I need to dynamically show a different image on a row-by-row basis based on the data in that row. Is there an example on how to do this? If not, if someone has figured this out can you post an example?
KS
Top achievements
Rank 1
 answered on 12 Jan 2015
1 answer
144 views
Hi Sir,
      Here, we are using Report Book for multiple reports for a particular patient. Where the reports, occupies every single page for each report.
so, here i am tried with Sub Report., but i cant able to get the solution as well. I need to merge multiple reports. 

please see the attachment (screenshot : Print.jpg)

Thanks & Regards,
 R. Sindhu.

Stef
Telerik team
 answered on 09 Jan 2015
20 answers
3.1K+ views
Hi again, I need to pass a parameter to reportViewer, in the report that I designed in telerik report designer I added a parameter so I want to pass the values ​​from a String value outside the ReportViewer I do not want to enter the value in the field shown in the reportviewer beside the preview button. (see report.png image) and i need s

Is there any way to access these properties? and how to resize the text box that receives the parameter because I want my reportviewer size you see in the picture but the box paraecer shrinks when I change the size of reportviewer, and I need to call the click event Preview button but from another button, is that possible? being so hide the parameter, and how I do to remove this error "An error has occurred while processing, incorrect syntax near ')' " this happens because I don't give a value I just set the "=Parameters.Name.Value"

Sorry for my English, I hope you can help me!
Fridli Jacober
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
173 views
I've reported this in a support ticket, but a) I haven't had a response yet, and b) I thought others ought to be aware of this too.
I've managed to get reports with the html5 report viewer working fine a few months ago, but somehow the instructions on the Telerik site don't seem to have kept up with changes to the standard Visual Studio MVC/WebApi templates.
From my support ticket request:

I've been trying to get even a basic Report working in MVC/WebApi projects and the Telerik current instructions as to how to do it no longer seem to work, perhaps because of changes in the versions of some Microsoft dlls (and possible changes in the template files, eg to WebApiConfig.cs and Global.asax) in current Visual Studio 2013 Update 3 projects.

I've had a variety of problems, including run time errors (like the one below, or saying that the .../client resource could not be found), but I attach an example project.

This project was just a basic, right out of the box MVC5/WebApi web application that I created from the templates in Visual Studio 2013 Update 3.  I checked that it built and ran fine. I then added a Telerik Html5 Report Viewer Item Template (Q3 2014) to the project.  A report page then came up telling me that I needed to add various redirects to the web.config file (because the project contained newer versions of dlls than those expected) - I added these lines to the web.config file.

Then I built the project successfully, but when I tried running it, I got the following error in Application_Start() in Global.asax.cs: " Adding or removing items from a 'HttpRouteCollection' is not supported. Please use a key when adding and removing items":


 // this line gives the following error when running the project:
            // Adding or removing items from a 'HttpRouteCollection' is not supported. Please use a key when adding and removing items.
            ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);

How can I solve this?  Please will you consider rechecking your installation instructions and modifying them as necessary so that they work with the current Visual Studio standard templates for MVC/WebApi projects?
Stef
Telerik team
 answered on 08 Jan 2015
12 answers
214 views
I don't understand why, but when I add a Table Wizard, I can't select or Add any Data source. Can you tell me why ?  thanks.
Stef
Telerik team
 answered on 08 Jan 2015
1 answer
297 views
I'm using the HTML5 report viewer with an ObjectDataSource.  The model referenced by the ObjectDataSource is populated by a logic call from a service that is injected in my MVC reports controller.  Unless the model exposes a static method to get the data for the report, no data is returned in the report (all fields are empty).  However, when the method is static, two different clients accessing two different sets of data (different filter parameters in the controller), are stepping on each other, and the wrong report is rendered for the second user.  For example, if I log in to my application from two different browsers (Chrome and FF, for example), load the report with different data filter parameters in each browser (which should display two different reports), and then refresh both browsers simultaneously, both render the same report because of the static method.  Obviously, this is a big problem for a multi-user web application - it is assumed that a report should be accessible by many users that are viewing different data.

How can an ObjectDataSource be used with non-static methods?  Or, assuming you have a business logic layer call that returns a collection of objects to feed a Telerik report, how should an HTML5 Telerik report be architected for multi-user access, where the same report can be rendered simultaneously for multiple users accessing different data (invoices for example)?

Thanks!
Stef
Telerik team
 answered on 08 Jan 2015
4 answers
479 views
Hi,

I am using the system font for controls while designing the reports.  

But those fonts are not shown up in the generated report pdf in even though the font installed in the system.

Stef
Telerik team
 answered on 07 Jan 2015
2 answers
760 views
  1. Hi,
    Currently my Client is converting pdf document which is generated to AFP document before printing them.But they are facing issues while converting PDF to AFP and then to print. They are getting blank screen while conversion.

    In our investigation we found that in his system encoding format is ANSI , but ours is Identity-H.

    So we want to change the encoding to ANSI while generating pdf document.

    Below is the sample code we are using
     
     1) aspx.cs file
          Telerik.Reporting.ReportBook rptListBook = new Telerik.Reporting.ReportBook();
          rptListBook.Reports.Add('Adding some report item here');
          ReportViewer1.Report = rptListBook;

    2) aspx file
       <telerik:ReportViewer ID="ReportViewer1" runat="server" Height="1px" Width="1px" ToolbarVisible="False" />

Please do the needful.

Stef
Telerik team
 answered on 07 Jan 2015
2 answers
248 views
I'm working on some crosstab reports that span multiple pages horizontally. The requirement is for each page header to indicate which columns are on that page e.g on page on it should say "Scenarios 1.1 to 1.6", on page 2 "Scenarios 1.7 to 2.5" etc.   The values (1.1., 1.2, 1.3 etc) would be from one of the column groups.

I can't work out how to do this or even if it is possible.  The attached png shows a mockup showing what I've been asked to achieve.
J
Top achievements
Rank 1
 answered on 07 Jan 2015
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?