3 Answers, 1 is accepted
With the introduction of the XML report definition the reports can exist not only as CLR types and objects in the memory but as XML markup stored in different ways (file, database, etc.). As we do not want to limit the users to work with only objects or files the need for a unified way for referencing reports in the applications emerged - Report Sources.
To show a report created with the standalone designer (.trdx file), you can use UriReportSource:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
Telerik.Reporting.UriReportSource uriReportSource =
new
Telerik.Reporting.UriReportSource();
// Specifying an URL or a file path
uriReportSource.Uri = @
"C:\MyWebApplication\Reports\Barcodes Report.trdx"
;
this
.ReportViewer1.ReportSource = uriReportSource;
}
}
If you prefer to work with CLR types and objects, you can deserialize the xml report definition as shown in the Serializing Report Definition in XML help article and proceed from there like you would normally do following the basic concepts of the programming language and the .NET platform.
Regards,
Steve
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!
(Firstly sorry for my English ) I have the same problem but in a Silverlight project. If I want to use Telerik.Reporting.UriReportSource is not posible because in my xaml.cs file does not exist-->attach file (imagen error.png)
Secondly I have tried to do http://www.telerik.com/help/reporting/wcf-report-service-how-to-add-custom-report-resolver.html in vb but it could not work. On the other hand I have found a complete example project in c#, but I haven´t found in vb. I download the project exampIe of http://blogs.telerik.com/telerikreportingteam/posts/12-05-07/extending-telerik-reporting-service-with-custom-ireportresolver.aspx and i have tried to convert project c# to vb but it does not work. -->attach file (imagen error.png).
Please It´s posible to share the same project in c# convert it to vb project example.
Thridly i try to deserialize the xml report definition as shown in the Serializing Report Definition in XML
Dim settings As New XmlReaderSettings()
settings.IgnoreWhitespace = True
Using xmlReader As System.Xml.XmlReader = System.Xml.XmlReader.Create("SampleReport1.trdx", settings)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
End Using
but i do not know how i can pass this deserialize file which is stored in variable Dim report As Telerik.Reporting.Report to my viewer which is in a .xaml file or .xaml.vb. Please the same question is it possible share a complete project example to help us?.
Finally, i would like to ask if in the q3 2012 there are a new ways to load report file .trdx, or something new way help us?
I am very worry because i don´t get to work telerik reports which loads report file .trdx.
Thanks
In Q3 2012 we have migrated to Silverlight 5 and one of the improvements is the native vector print.
Generally the reporting engine is not compatible with Silverlight and it requires .NET framework to perform its operations, in other words the reports reside on the server and you cannot process them in your Silverlight application directly and Telerik Reporting WCF Service enables the remote access to the Telerik Reporting Engine. The Reporting Service acts as a communication interface between the client programs and the report server. Thus you have to resolve report definition and make the report definition changes on the server and this why we have provided the IReportResolver. In this line of thoughts our suggestion is to deserialize the reports, set up the report instance and serialize it again to a temporary location for report service usage as shown in the following IReportResolver implementation:
Imports
Telerik.Reporting
Imports
System.IO
Imports
Telerik.Reporting.Service
Public
Class
ReportResolve
Implements
IReportResolver
Public
Function
Resolve(reportName
As
String
)
As
ReportSource
Implements
IReportResolver.Resolve
'Try to reuse an already updated trdx
Try
Dim
uri
As
New
Uri(reportName)
Return
New
UriReportSource()
With
{ _
.Uri = reportName _
}
Catch
generatedExceptionName
As
UriFormatException
End
Try
Dim
settings =
New
System.Xml.XmlReaderSettings()
settings.IgnoreWhitespace =
True
Using xmlReader = System.Xml.XmlReader.Create(
Me
.MapPath(
"report.trdx"
), settings)
Dim
xmlSerializer =
New
Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim
report =
DirectCast
(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
Dim
dataSource =
DirectCast
(report.DataSource, Telerik.Reporting.SqlDataSource)
dataSource.ConnectionString =
""
dataSource.SelectCommand =
""
Dim
reportFilePath
As
String
= MapPath(
String
.Format(
"report{0}.xml"
, Guid.NewGuid()))
Using fileStream =
New
FileStream(reportFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)
Using xmlWriter = System.Xml.XmlWriter.Create(fileStream)
xmlSerializer.Serialize(xmlWriter, report)
End
Using
End
Using
Dim
reportSource
As
New
UriReportSource
reportSource.Uri = reportFilePath
Return
reportSource
End
Using
End
Function
Private
Function
MapPath(path
As
String
)
As
String
Return
HttpContext.Current.Server.MapPath(path)
End
Function
End
Class
Greetings,
Peter
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!