Interface IDataGroupMember
Provides an unified access to the data of a group member
Inherited Members
Namespace: Telerik.Reporting.Processing
Assembly: Telerik.Reporting.dll
Syntax
public interface IDataGroupMember : IDataObject
Methods
EnumerateRawData()
Enumerates all data items (details) that belongs to the current group member.
Declaration
IEnumerable EnumerateRawData()
Returns
System.Collections.IEnumerable
A set of raw data items that belongs to the current group member. |
Examples
The following example, uses the IDataGroupMember.EnumerateRawData() to display the detail items for each member of the Country group.
public class Address
{
string country;
string city;
public string City
{
get { return this.city; }
set { this.city = value; }
}
public string Country
{
get { return this.country; }
set { this.country = value; }
}
public Address(string country, string city)
{
this.country = country;
this.city = city;
}
}
public class Report1 : Telerik.Reporting.Report
{
public Report1()
{
this.InitializeComponent();
this.DataSource = new Address[]
{
new Address("UK", "London"),
new Address("USA", "Boston"),
new Address("UK", "Manchester"),
new Address("UK", "Liverpool"),
new Address("USA", "New York"),
new Address("USA", "Houston"),
};
}
private void InitializeComponent()
{
((System.ComponentModel.ISupportInitialize)this).BeginInit();
this.detailSection = new Telerik.Reporting.DetailSection();
this.groupHeaderSection = new Telerik.Reporting.GroupHeaderSection();
this.groupFooterSection = new Telerik.Reporting.GroupFooterSection();
this.groupHeaderSection.ItemDataBound += new System.EventHandler(groupHeaderSection_ItemDataBound);
this.groupFooterSection.ItemDataBound += new System.EventHandler(groupFooterSection_ItemDataBound);
this.Items.AddRange(new Telerik.Reporting.ReportItemBase[]
{
this.groupHeaderSection,
this.detailSection,
this.groupFooterSection,
});
Telerik.Reporting.Group group1 = new Telerik.Reporting.Group();
group1.Name = "Country";
group1.GroupHeader = this.groupHeaderSection;
group1.GroupFooter = this.groupFooterSection;
group1.Groupings.AddRange(new Telerik.Reporting.Grouping[] { new Telerik.Reporting.Grouping("=Fields.Country"), });
this.Groups.AddRange(new Telerik.Reporting.Group[] { group1 });
((System.ComponentModel.ISupportInitialize)this).EndInit();
}
void groupHeaderSection_ItemDataBound(object sender, System.EventArgs e)
{
Telerik.Reporting.Processing.GroupSection groupSection = sender as Telerik.Reporting.Processing.GroupSection;
Telerik.Reporting.Processing.IDataGroupMember dataGroupMember = groupSection.DataObject as Telerik.Reporting.Processing.IDataGroupMember;
Console.WriteLine("--- Begin '{0}' ---", groupSection.DataObject["Country"]);
Console.WriteLine("(header)");
EnumerateGroupMemberRawData(dataGroupMember);
}
void groupFooterSection_ItemDataBound(object sender, System.EventArgs e)
{
Telerik.Reporting.Processing.GroupSection groupSection = sender as Telerik.Reporting.Processing.GroupSection;
Telerik.Reporting.Processing.IDataGroupMember dataGroupMember = groupSection.DataObject as Telerik.Reporting.Processing.IDataGroupMember;
Console.WriteLine("(footer)");
EnumerateGroupMemberRawData(dataGroupMember);
Console.WriteLine("--- End '{0}' ---", groupSection.DataObject["Country"]);
}
static void EnumerateGroupMemberRawData(Telerik.Reporting.Processing.IDataGroupMember dataGroupMember)
{
foreach (Address address in dataGroupMember.EnumerateRawData())
{
Console.WriteLine(string.Format(" {0} - {1}", address.Country, address.City));
}
}
Telerik.Reporting.DetailSection detailSection;
Telerik.Reporting.GroupHeaderSection groupHeaderSection;
Telerik.Reporting.GroupFooterSection groupFooterSection;
}
Public Class Address
Public Sub New(ByVal country As String, ByVal city As String)
_country = country
_city = city
End Sub
Public Property City() As String
Get
Return _city
End Get
Set(ByVal value As String)
_city = value
End Set
End Property
Public Property Country() As String
Get
Return _country
End Get
Set(ByVal value As String)
_country = value
End Set
End Property
Private _city As String
Private _country As String
End Class
Public Class Report1
Inherits Report
Public Sub New()
Me.InitializeComponent()
MyBase.DataSource = New Address() {New Address("UK", "London"), _
New Address("USA", "Boston"), _
New Address("UK", "Manchester"), _
New Address("UK", "Liverpool"), _
New Address("USA", "New York"), _
New Address("USA", "Houston")}
End Sub
Private Shared Sub EnumerateRawData(ByVal dataGroupMember As Telerik.Reporting.Processing.IDataGroupMember)
Dim address As Address
For Each address In dataGroupMember.EnumerateRawData
Console.WriteLine(String.Format(" {0} - {1}", address.Country, address.City))
Next
End Sub
Private Sub groupFooterSection_ItemDataBound(ByVal sender As Object, ByVal e As EventArgs)
Dim groupSection As Telerik.Reporting.Processing.GroupSection = TryCast(sender, Telerik.Reporting.Processing.GroupSection)
Dim dataGroupMember As Telerik.Reporting.Processing.IDataGroupMember = TryCast(groupSection.DataObject, Telerik.Reporting.Processing.IDataGroupMember)
Console.WriteLine("(footer)")
Report1.EnumerateRawData(dataGroupMember)
Console.WriteLine("--- End '{0}' ---", groupSection.DataObject.Item("Country"))
End Sub
Private Sub groupHeaderSection_ItemDataBound(ByVal sender As Object, ByVal e As EventArgs)
Dim groupSection As Telerik.Reporting.Processing.GroupSection = TryCast(sender, Telerik.Reporting.Processing.GroupSection)
Dim dataGroupMember As Telerik.Reporting.Processing.IDataGroupMember = TryCast(groupSection.DataObject, Telerik.Reporting.Processing.IDataGroupMember)
Console.WriteLine("--- Begin '{0}' ---", groupSection.DataObject.Item("Country"))
Console.WriteLine("(header)")
Report1.EnumerateRawData(dataGroupMember)
End Sub
Private Sub InitializeComponent()
DirectCast(Me, System.ComponentModel.ISupportInitialize).BeginInit()
Me.detailSection = New DetailSection
Me.groupHeaderSection = New GroupHeaderSection
Me.groupFooterSection = New GroupFooterSection
AddHandler Me.groupHeaderSection.ItemDataBound, New EventHandler(AddressOf Me.groupHeaderSection_ItemDataBound)
AddHandler Me.groupFooterSection.ItemDataBound, New EventHandler(AddressOf Me.groupFooterSection_ItemDataBound)
MyBase.Items.AddRange(New ReportItemBase() {Me.groupHeaderSection, Me.detailSection, Me.groupFooterSection})
Dim group1 As New Group
group1.Name = "Country"
group1.GroupHeader = Me.groupHeaderSection
group1.GroupFooter = Me.groupFooterSection
group1.Groupings.AddRange(New Telerik.Reporting.Grouping() {New Telerik.Reporting.Grouping("=Fields.Country")})
MyBase.Groups.AddRange(New Group() {group1})
DirectCast(Me, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Private detailSection As DetailSection
Private groupFooterSection As GroupFooterSection
Private groupHeaderSection As GroupHeaderSection
End Class