3 Answers, 1 is accepted
You need to deserialize the .trdx report to a report object, which you can later add to a report book:
public
Report DeserializeReport(
string
path)
{
System.Xml.XmlReaderSettings settings =
new
System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace =
true
;
using
(System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(path, settings)) {
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
return
report;
}
}
Regards,
Nasko
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I posted a thread somewhere else with no answer, so I will ask it here as well. I have this part working, I just can't figure out how to get the report to connect to the sqldatasource now. The viewer shows the reports, they just have no data in them.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GetCIReport()
GetAffiliationsReport()
CreateReportBook()
ReportViewer1.ReportSource = reportBook
End Sub
#Region "Events"
#End Region
#Region "Methods"
Public Function DeserializeReport(path As String) As Report
Dim settings As New System.Xml.XmlReaderSettings()
settings.IgnoreWhitespace = True
Using xmlReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(path, settings)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
Return report
End Using
End Function
Protected Sub GetCIReport()
Dim sqlCIData As SqlDataSource = New SqlDataSource()
sqlCIData.ConnectionString = "Data Source=DATASERVER;Initial Catalog=AppForFinancing;Persist Security Info=True;User ID=********;Password=*******************"
sqlCIData.SelectCommand = "SELECT * FROM ContactInformation WHERE id=1"
CIReport.DataSource = sqlCIData
CIReport = DeserializeReport("CHURCHCONTACTINFORMATION.trdx")
End Sub
You can check your thread for more information on your case.
Regards,
Nasko
Telerik