I have made an ASP.NET CORE 1.0 web app. Yes I know it's not final. For the life of me I can not figure out how to get my Reports to display.
Is it possible? Anyone succeeded and can share the steps and a bit of code?
Thanks
I guess I'll never change. I am always drawn to trying the Bleeding Edge in development. Yes. It always bites me.
8 Answers, 1 is accepted
The available Telerik Reporting Nuget packages are for educational purpose only, not ready for production.
More details how to get the packages and test them are discussed in the Reporting in MVC 6 forum thread.
Let us know if you have any further questions.
Regards,
Stef
Telerik
Can we use telerik reporting in dotnet core 1.0.0 preview 2 003131 version??
The latest Nuget packages are built for .NET Core 1.0.1 projects targeting .NET4.6.1 framework - HTML5 Report Viewer in ASP.NET Core.
You can use an older version of Telerik Nuget packages to target an earlier release of .NET Core. Nuget packages are accessible through the private Telerik Nuget feed, that can be accessed with your Telerik account's credentials.
Regards,
Stef
Telerik by Progress
Hello,
Could you please share an example project for it can be downloaded (without report viewer) in asp core
Thank you, regards
I am attaching here one sample project that is targeting ASP.NET Core 1.0.1.
Regards,
Katia
Progress Telerik
Hi Katia,
If you have same project using Entity Framework, could you please share it also?
Thank you, regards.
Hi Katia,
I am looking your example, and i saw some problem about asp.net core. Your example framework type .net framework 4.x but you say this project is asp.net core but i cant find it, and i am developing on asp.net core but telerik.reporting not working with this code.
public
static
string
reportsPath;
public
static
byte
[] ExportToPDF(
string
report, Telerik.Reporting.DataSource dbSource, Dictionary<
string
,
object
> parameters =
null
)
{
Telerik.Reporting.Report reportToExport;
if
(parameters !=
null
)
reportToExport = Resolve(report, parameters);
else
reportToExport = Resolve(report);
reportToExport.DataSource = dbSource;
ReportProcessor reportProcessor =
new
ReportProcessor();
InstanceReportSource instanceReportSource =
new
InstanceReportSource();
instanceReportSource.ReportDocument = reportToExport;
RenderingResult result = reportProcessor.RenderReport(
"PDF"
, instanceReportSource,
null
);
return
result.DocumentBytes;
}
public
static
Telerik.Reporting.Report Resolve(
string
report, Dictionary<
string
,
object
> parameters =
null
)
{
var urs =
new
UriReportSource();
urs.Uri = reportsPath +
"\\"
+ report;
if
(parameters !=
null
)
foreach
(var parameter
in
parameters)
{
urs.Parameters.Add(
new
Telerik.Reporting.Parameter(parameter.Key, parameter.Value));
}
return
UnpackageReport(urs);
}
public
static
Telerik.Reporting.Report UnpackageReport(UriReportSource uriReportSource)
{
var reportPackager =
new
ReportPackager();
var dir = Directory
.GetFiles(reportsPath)
.Select(path =>
Path.GetFileName(path));
using
(var sourceStream = System.IO.File.OpenRead(uriReportSource.Uri))
{
var report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
return
report;
}
}
public
static
DataTable ToDataTable<T>(
this
IList<T> data)
{
PropertyDescriptorCollection props =
TypeDescriptor.GetProperties(
typeof
(T));
DataTable table =
new
DataTable();
for
(
int
i = 0; i < props.Count; i++)
{
PropertyDescriptor prop = props[i];
table.Columns.Add(prop.Name, prop.PropertyType);
}
object
[] values =
new
object
[props.Count];
foreach
(T item
in
data)
{
for
(
int
i = 0; i < values.Length; i++)
{
values[i] = props[i].GetValue(item);
}
table.Rows.Add(values);
}
return
table;
}
and i attached your projects properties. Could you help me about how it work?
@Emrah, unfortunately I do not have a sample project that satisfies the exact requirements listed by you at hand. In general, to connect the report to ADO.NET Entity Data Model you can use EntityDataSource Component. EntityDatasource component requires a constructor where it can pass a connection string for connecting to the source database, more detailed information can be found in EntityDatasource Settings help article.
Steps how to connect to EF model are provided in EntityDataSource Wizard help article.
@Burak, .NET Core project that hosts the Reporting REST service must target standard .NET framework e.g. net461, this is required by the rendering mechanism that depend on the GDI+ API.
For targeting multiple platforms with ASP.NET Core Application, you can add HTML5 Viewer as a JavaScript widget which does not require any Telerik NuGet packages.
The Reporting REST service can be hosted separately where the HTML5 Viewer will only need the address of the service.
More detailed information is provided in the updated HTML5 Report Viewer in ASP.NET Core 2 help article.
Regards,
Katia
Progress Telerik