This is a migrated thread and some comments may be shown as answers.

Add UriReportSource to ReportBook;

3 Answers 116 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raymond E
Top achievements
Rank 1
Raymond E asked on 14 Jul 2014, 03:18 PM
how do you I add a UriReportSource to a reportbook? I can't figure out how to use UriReportSource to create a new Report that I can then add to the report book.

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 16 Jul 2014, 09:27 AM
Hello Raymond,

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.

 
0
Levi
Top achievements
Rank 1
answered on 10 Dec 2015, 08:12 PM

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

0
Nasko
Telerik team
answered on 11 Dec 2015, 02:45 PM
Hello Levi,

You can check your thread for more information on your case.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Raymond E
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Levi
Top achievements
Rank 1
Share this question
or