Telerik Forums
Reporting Forum
6 answers
3.2K+ views
I am trying to configure Telerik Reporting into MVC application.
The things which are done.
1. Installed libraries: Data Access(2014.3.1209.1), Telerik Report (8.2.14.1204), System.Web.Http(5.2.2.0)

2. Registered Reporting route on WebApiConfig.
Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config);

3. Added reporting controller
    public class ReportsController : ReportsControllerBase
    {
        protected override IReportResolver CreateReportResolver()
        {
            var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");

            return new ReportFileResolver(reportsPath)
                .AddFallbackResolver(new ReportTypeResolver());
        }

        protected override ICache CreateCache()
        {
            return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
        }
    }

While building application I am getting this error:
----------------------------------------------------------------------------------------
Unable to load assembly 'Project.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
ExceptionString:
System.SystemException: Unable to load assembly 'Project.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   --- End of inner exception stack trace ---
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
   at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()    C:\Projects\ProjectAbc\Project.Web\obj\Debug\Project.Web.dll    Project.Web

----------------------------------------------------------------------------------------

Yes, this clearly means that mapping is missed out for System.Web.Http but it is being set correctly:
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
      </dependentAssembly>

From error it seems like, it is related to Data Access but if I comment entire class (ReportsController) from step 3 then it is working fine. Also during upgrade I have cleared cache from every possible location .Net Temp, bin folder, checked proper reference of libraries. This is my first attempt to use Telerik reporting on my existing application.

Please suggest what needs to be done.

Stef
Telerik team
 answered on 30 Jan 2015
2 answers
148 views


1) I am developing a custom Web application to display reports. My IDE is Visual Studio 2013.

2) I am running the current version of Reporting Version=8.2.14.1204 with IE10 as my browser and my reports are overflowing the Reportviewer on the bottom. Oddly enough it is by the same amount as the combined height of the toolbar and parameters area. See uploaded pic. I have tried everything I can think of to solve this issue with no success. Any suggestions would be greatly appreciated.

Stef
Telerik team
 answered on 30 Jan 2015
1 answer
734 views
For a textbox I use

Private Sub nvcQuestion_ItemDataBound(sender As Object, e As EventArgs) Handles nvcQuestion.ItemDataBound
Dim txt As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
Dim dataObject As Telerik.Reporting.Processing.IDataObject = DirectCast(txt.DataObject, Telerik.Reporting.Processing.IDataObject)
If DirectCast(dataObject("nvcqQuestion"), String) <> "" Then
   txt.Value = dataObject("nvcqQuestion").ToString()
End If
End Sub

For a Checkbox I tried something like the following

Private Sub bitTitle_ItemDataBound(sender As Object, e As EventArgs) Handles bitTitle.ItemDataBound
Dim txt As Telerik.Reporting.Processing.CheckBox = DirectCast(sender, Telerik.Reporting.Processing.CheckBox)
Dim dataObject As Telerik.Reporting.Processing.IDataObject = DirectCast(txt.DataObject, Telerik.Reporting.Processing.IDataObject)
If DirectCast(dataObject("bitTitle"), CheckBox) = True Or False Then
   txt.Checked = dataObject("bitTitle") ????????
End If
End Sub

Can anyone point out the problem and what the correct syntax is?
Thanks,
John
Hinata
Top achievements
Rank 1
 answered on 30 Jan 2015
2 answers
361 views
Hello, 

I have a report which contains a PictureBox with an URL as value property.

When I export to PDF or Excel, the image is displayed with no problems.

However, when I try to export the report to HTML5 (which generate multiple streams), the image is not converted to an HTML tag (like <img>). What I see instead is something like this : "����JFIF��� ( %!1!%)+...383,7(-.+  ,$$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,���� ...". It's the representation in text of the image.

Is there anyway to fix this problem?

Here is the code I use to export in HTML5:

//Method used for rendering the report
public List<Stream> GenerateTelerik(string languageCode = "en")
        {
            CultureInfo cultureInfo;
            cultureInfo = languageCode == "fr" ? new CultureInfo("fr-CA") : new CultureInfo("en-US");
 
            // Set the language for static text (i.e. column headings, titles)
            System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
 
            // Set the language for dynamic text (i.e. date, time, money)
            System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
 
            var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
 
            // set any deviceInfo settings if necessary
            var deviceInfo = new System.Collections.Hashtable();                      
 
            var reportviewer = new Telerik.Reporting.InstanceReportSource
            {
                ReportDocument = _reportObject
            };
 
            var renderType = getRenderType(_exportFormat);
 
            if (_exportFormat == ExportFormat.HTML5)
            {
                deviceInfo["OutputFormat"] = renderType;
                string documentName;
 
                var result = reportProcessor.RenderReport(renderType, reportviewer, deviceInfo, CreateStream,
                    out documentName);
 
                if (result)
                {         
                    return _streams;
                }
 
                throw new Exception("Failed to export to HTML5");
            }
            else
            {
                var result = reportProcessor.RenderReport(renderType, reportviewer, deviceInfo);
                _streams.Add(new MemoryStream(result.DocumentBytes));
                return _streams;
            }
 
        }
 
//For Handling multiple streams
Stream CreateStream(string name, string extension, Encoding encoding, string mimeType)
        {
            string path = Path.GetTempPath();
            string filePath = Path.Combine(path, name + "." + extension);
 
            FileStream fs = new FileStream(filePath, FileMode.Create);
            _streams.Add(fs);
            return fs;
        }
 
//And when I want to render the HTML5 to the browser: (method in a controller in MVC application)
private HttpResponseMessage GetHtml5ResponseMessage(List<Stream> streams, TelerikReporting.ExportFormat exportFormatTyped)
        {
            string data = string.Empty;
            foreach (var stream in streams)
            {
                StreamReader readStream = null;
                stream.Position = 0;
                readStream = new StreamReader(stream);
                data += readStream.ReadToEnd();
                readStream.Close();
            }
 
            return new HttpResponseMessage()
            {
                Content = new StringContent(data, Encoding.UTF8, getMIMEType(exportFormatTyped))
            };
        }



Dominic
Top achievements
Rank 1
 answered on 29 Jan 2015
1 answer
185 views
I'm using the Html5 Report Viewer to display reports generated with ASP.NET MVC. I was able to internationalize most of its content but I struggle with the export-menu (see attachment). The text "CSV (comma delimited) seems to be embedded in the report and being retrieved from the resource "Telerik.Reporting.CsvRendering.CsvRenderingExtension.resx" inside the Telerik.Reporting.dll (ASP.NET MVC). The Telerik.Reporting.dll only contains the english resources.

Where can I get the localized resources (e.g as satellite assemblies)  or what's the easiest way to localizing those? (At least German and French would be helpful to start with)

Thanks a lot!


Hinata
Top achievements
Rank 1
 answered on 28 Jan 2015
5 answers
232 views
I've got an existing RESTful API developed to support the rest of our products, I'm wondering if there is a way to use the reporting services with that. The API is written in c# and uses ServiceStack, satisfying many of the requirements for the reporting services.

Following the guide here seems to have been a good start: http://www.telerik.com/help/reporting/telerik-reporting-rest-servicestack-hosting-iis.html

The trouble I'm running into is that ReportsHostBase seems to derive from the ServiceStack class AppHostBase. Obviously our existing project already has an AppHostBase instance, so I can't use the Init member of ReportsHostBase. It appears as if Init creates a report resolver as well as some sort of cache provider.

So I guess my question is this... Has anybody ever added Telerik reporting services to an existing ServiceStack project? 
Stef
Telerik team
 answered on 28 Jan 2015
7 answers
137 views
Hi

We are using telerik reporting (the pre HTML5 release)

When you export to word from telerik reporting on a webforms report viewer application onto a PC the images and reporting are perfect. However when exporting to word (docx) onto a mac of all types, the images are shrunk??? When I load the file that was not working on my mac onto a pc the images work again?

See attached image example.

Thanks
Duncan
Stef
Telerik team
 answered on 27 Jan 2015
1 answer
128 views
We are running into a problem where our users will see a Null Reference Exception message ("Object reference not set to an instance of an object") when they switch to (or from) Print Preview mode after the report has "expired".  Sometimes the report will expire because they waited too long (I think 20 minutes is the timeout on most of our servers) or if IIS happened to recycle while they were working on the report.  For other operations (such as changing pages), the user gets a friendly message that says: "Report is unavailable or session has expired".  It would be nice if they got a similiar friendly message in the Print Preview case.

We are on a slightly old version of Reporting but I've verified the bug is in the latest version (Q3 2014 SP1).  We use the Silverlight report viewer.

To reproduce the problem, run a report.  Then on the server you can execute the following method to clear out the cache (simulating IIS recycling or the session timing out):

        private void ClearCache()
        {
            var cache = System.Web.HttpContext.Current.Cache;
            var enumerator = cache.GetEnumerator();
            while (enumerator.MoveNext())
            {
                cache.Remove((string)enumerator.Key);
            }
        }

Then when you go to Print Preview mode, you'll see the error.  Screenshot attached.

Stef
Telerik team
 answered on 26 Jan 2015
8 answers
227 views
Hello,

  I use "ColumnHeadersPrintOnEveryPage" setting to repeat column headers on each page in the report.
  It sucessfully works when I export the report to PDF or Word, but unfortunately does not work when I export it into Excel.
  
  Is it possible to mark some rows in the report do be repeated on each page in Excel during exporting to excel (see picture)?

Thanks,
-Andrey Popov
Stef
Telerik team
 answered on 24 Jan 2015
5 answers
1.5K+ views
The report preview in the designer does not display any report data if the sqldatasource attached returns an empty resultset.

I created a blank report and added one textbox to the report header and clicked "Preview" in the designer.  The textbox is displayed as expected.  But if I add a sqldatasource whose result set is empty nothing displays in the preview.  If the resultset is not empty and returns data then my textbox is displayed in the preview as expected.

I would like for my report to show the static fields even if the sqldatasource returns with an empty resultset.

Thanks,

Matt
Stef
Telerik team
 answered on 24 Jan 2015
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?