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

Hiding Empty SubReports in 2012

1 Answer 136 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 22 Aug 2012, 03:54 PM
I previously had code to hide my subreports if they are empty.  This code gets an warning now. 

'Public ReadOnly Property ChildElements As Telerik.Reporting.Processing.ProcessingElement.ElementCollection' is obsolete: 'The Telerik.Reporting.Processing.ProcessingElement.ChildElements property is now obsolete. Use Telerik.Reporting.Processing.ElementTreeHelper.GetChildElements() method instead.'

I have looked into the GetChildElements information, but I cannot convert this code properly to remove the warnings.  What is the new way of doing this?

Private Sub subFilesAttached_ItemDataBound(ByVal sender As Object, ByVal e As EventArgs) _
    Handles subFilesAttached.ItemDataBound
    Dim subReport As SubReport = sender
    Dim report As Processing.Report = subReport.InnerReport
    subReport.Visible = report.ChildElements.Find("detail", True).Length > 0
End Sub

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Aug 2012, 03:52 PM
Hi Eric,

Here is the correct code snippet:

Private Sub subFilesAttached_ItemDataBound(sender As Object, e As System.EventArgs)
    Dim subReport As Processing.SubReport = DirectCast(sender, Processing.SubReport)
    Dim report As Processing.Report = DirectCast(subReport.InnerReport, Processing.Report)
    subReport.Visible = Telerik.Reporting.Processing.ElementTreeHelper.FindChildByName(report, "detail", True).Length > 0
End Sub

Kind regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Eric
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or