Hi,
I'm within an MVC project, and I'd like to generate a PDF with the data contained into my Model. So I've created a Report using Telerik Reporting, and now I'd like to link it with my MVC Model.
The render is easy:
ReportRegistration reportRegistration = new ReportRegistration();
string fileName = @"C:\ReportRegistration.pdf";
ReportProcessor reportProcessor = new ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = reportRegistration;
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}
but how do I bind data in that model to the designer? For example, in Attach the Designer I have. I'd like to use the data inside BusinessName member variabile inside my Model. Tried ObjectDataResorce but when I double click, Visual Studio crash.
Thanks
Hello,
I'm a little new on Telerik Reporting, but I have a big issue. I try to make a simple calculation of a field to result a TOTAL sum... but instead of SUM i recive a kind of CONCATENATE of my cells
Picture below:
I have a report with simply a table on it. I want to display all of the data I grabbed from EF as an IEnumerable onto said table.
How do I accomplish this?
I have a very simple query (below). I have tested in SQL Management Studio as well as the Configure DataSource in the Telerik Report Designer. Both return 19 rows of data. I added the ISNULL as those fields have the ability to be NULL and wanted to eliminate them from causing an error. If there is no parameter in query everything works . When a parameter is filled in I see the title of the TABLE but the rest is blank. I know this is something beyond simple.
If I put in a default value into the parameter field on the table not even the header appears. The attachment shows how the Parameter is setup. Originally I was trying to pass the RegardingIdentifier () and through that was it so I modified the routine to use a string and still get the same results.
SELECT
Tasks.TaskIdentifier
, Tasks.RegardingIdentifier
, Tasks.StatusIdentifier
, Tasks.TaskNumber
, Tasks.DescriptionShort
, Tasks.StartDate
, Tasks.DueDate
, ISNULL(Tasks.Priority, 'Normal') AS Priority
, ISNULL(Tasks.EstimatedHours, 0) AS EstimatedHours
, ISNULL(Tasks.PercentComplete, 0) AS PercentComplete
, ISNULL(Status.FieldName, '') AS TaskStatus
FROM
Tasks
LEFT OUTER JOIN AppSettings Status ON Tasks.StatusIdentifier = Status.AppSettingIdentifier
LEFT OUTER JOIN Accounts ON Tasks.RegardingIdentifier = Accounts.AccountIdentifier
WHERE
(Accounts.AccountCode = @AccountCode)
AND (Tasks.TaskComplete = 0)
ORDER BY
Tasks.TaskNumber
I am currently working towards moving our report files into database storage. I have setup a custom resolver that is able to get the report from the id properly; however, when the subreport is loaded, it does not appear to be using the /api/reports serviceUrl. instead, it is looking in the root directory of the project in visual studio and not being routed through the Reports controller. Of course, the report is not there. What do I need to do to make the reports to evaluate on the serviceUrl to get it like the other reports?
Here's my resolver:
public class DatabaseReportResolver : Telerik.Reporting.Services.Engine.IReportResolver
{
public ReportSource Resolve(string message)
{
using (var _context = new CommonDataContext())
{
var report = _context.ReportRecord.FirstOrDefault(x => x.UniqueName == message);
if(report == null)
{
return null;
}
var fileContent = report.ReportFiles.OrderByDescending(x => x.DateActive).FirstOrDefault();
if (fileContent != null)
{
var file = fileContent.File;
XmlReportSource source = new XmlReportSource();
source.Xml = System.Text.Encoding.Default.GetString(file);
return source;
}
}
return null;
}
}
In my current project, ASP.NET Core 2 (on full .Net framework), users will have no use for the Navigate backward, Navigate forward, Toggle parameters, Toggle document buttons. These are disabled but I would like to remove them from the toolbar. Do you have an example on how to do this?
Thanks
Hi,
we try generating reports on the server simultaneously:
Parallel.ForEach(x, x =>
{
...
ReportProcessor.RenderReport(...);
....
}
and get the occasional exception below:
System.AggregateException: One or more errors occurred. ---> Telerik.Reporting.Processing.CancelProcessingException: An error occurred while evaluating the report parameters. Report source cannot be processed. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: path2
at System.IO.Path.Combine(String path1, String path2, String path3)
at Telerik.Reporting.Interfaces.LocalizationContext.InitializeBucket(String resx)
at Telerik.Reporting.Interfaces.LocalizationContext.GetString(String resx, String key)
at Telerik.Reporting.Interfaces.StringsResolver.GetString(String key)
at Telerik.Reporting.SRDescriptionAttribute.get_Description()
at Telerik.Reporting.Expressions.EnumContextManager.GetItem(Type enumType)
at Telerik.Reporting.Processing.ReportExpressionContext.RegisterAllReportingEnums()
at Telerik.Reporting.Processing.ReportExpressionContext..ctor(Type reportType)
at Telerik.Reporting.Processing.ReportParametersManager`1.CreateExpressionContext(Report report, IList`1 runtimeParameters)
at Telerik.Reporting.Processing.ReportParametersManager`1..ctor(Report definitionReport, IEnumerable`1 definitionParameters, IDictionary`2 reportSourceParameters, IDataProviderContext dataProviderContext)
at Telerik.Reporting.Processing.DocumentParametersManager`1.CreateManager(Report definition, IDataProviderContext dataProviderContext, IParameterValueParser parameterValueParser, IDictionary`2 rsParameters)
at Telerik.Reporting.Processing.DocumentParametersManager`1.CreateManagers(IProcessingContext context, IParameterValueParser parameterValueParser)
at Telerik.Reporting.Processing.DocumentParametersManager`1..ctor(ResolvedReportDocument resolvedReports, IProcessingContext processingContext, IParameterValueParser parameterValueParser)
at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, IRenderingContext context)
--- End of inner exception stack trace ---
at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, IRenderingContext context)
at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, Hashtable deviceInfo, IRenderingContext context)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)
All the reporting assemblies are the latest.
Can the issue be related to?:
https://www.telerik.com/forums/is-the-reportprocessor-renderreport-function-thread-safe
Thank you,
Vlad
Hi Team,
I am new to Reporting. We have created a reporting Project using Telerik Reporting. It is working fine in Chrome and Mozilla. But it is not working in IE.
I am not getting any error
Please find the details below.
Aspx Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="IWarrantyClaimSearch.WebForm2" %>
<%@ Register Assembly="Telerik.ReportViewer.Html5.WebForms, Version=12.0.18.227, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.Html5.WebForms" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<script src="Scripts/jquery-1.10.2.min.js"></script>
<%--<script src="Scripts/polyfill.min.js"></script>--%>
</head>
<body>
<form id="form1" runat="server">
<telerik:DeferredScripts ID="DeferredScripts1" runat="server" />
<telerik:ReportViewer ID="ReportViewer1" runat="server"></telerik:ReportViewer>
</form>
</body>
</html>
C# Code
protected void Page_Load(object sender, EventArgs e)
{
Telerik.ReportViewer.Html5.WebForms.ReportSource reportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource;
reportSource.Identifier = @"Report/Report1.trdp";
ReportViewer1.ReportSource = reportSource;
ReportViewer1.Visible = true;
}
Please help me on this. It is very critical For me