Hi,
I need to put a subreport in a groupfooter, and I can't seem to make it work.
So, I have a Master Report, called List, this object has several properties that have to be set on the Master report.
In the detailsection I've put an SubReport, this Detail Report contains all lines from the List.
Until here, everything works great.
In the detailreport I've added several groups, because the lines have to be grouped.
Example:
Driver A (Driver-Group)
Customer X (Customer Group)
Address XYZ (Address Group)
- Line1
- Line 2
- Line 3
Address XYZ Footer: SubReport with all carriers on line 1,2,3
Address ABC
- Line 4
- Line 5
Adress ABC Footer: Subreport with all carriers on line 4,5
Customer Y
...
Driver B
...
So I've managed to display all lines corretly,
I've also managed to get all group-data (Driver A, Customer X, Address XYZ)
By storing it in private variable in the detail_ItemDataBound,
when I debug I see that the correct data is being fetched.
or by using the data I find for each Address-group:
which is sufficient to me to get data for the subreport in the footer.
Only the last line of code (subTLCarriers1.DataSource = amountOfCarriers;) sets the datasource on the control on the Detail Report, not the instance of the subreport in de groupFooter, as result, I get the same subreport for ALL the groups in my Detail Report instead of a different subreport for each address-group of lines.
Could you help me find a way to set the DataSource of each instance of the subreport in the Group-Footer,
so that each Address-Group get it's own subreport in it's footer?
Any help is very much welcome since I've been struggling with this for a few days now.
I need to put a subreport in a groupfooter, and I can't seem to make it work.
So, I have a Master Report, called List, this object has several properties that have to be set on the Master report.
In the detailsection I've put an SubReport, this Detail Report contains all lines from the List.
Until here, everything works great.
In the detailreport I've added several groups, because the lines have to be grouped.
Example:
Driver A (Driver-Group)
Customer X (Customer Group)
Address XYZ (Address Group)
- Line1
- Line 2
- Line 3
Address XYZ Footer: SubReport with all carriers on line 1,2,3
Address ABC
- Line 4
- Line 5
Adress ABC Footer: Subreport with all carriers on line 4,5
Customer Y
...
Driver B
...
So I've managed to display all lines corretly,
I've also managed to get all group-data (Driver A, Customer X, Address XYZ)
By storing it in private variable in the detail_ItemDataBound,
when I debug I see that the correct data is being fetched.
private
void
detail_ItemDataBound(
object
sender, EventArgs e)
{
Telerik.Reporting.Processing.DetailSection detailSection = (Telerik.Reporting.Processing.DetailSection)sender;
TransportListDocument doc = (TransportListDocument)detailSection.DataObject.RawData;
if
(doc !=
null
)
{
if
( String.IsNullOrEmpty(doc.Memo))
{
txtMemo.Visible =
false
;
captionMemo.Visible =
false
;
}
txtType.Value = Translator.Translate(
"_"
+ doc.DocumentType);
listId = doc.TransportListId;
driverId = doc.Driver.Id;
customerId = doc.Customer.Id;
addressId = doc.Address.Id;
}
}
private
void
subCarriers_NeedDataSource(
object
sender, EventArgs e)
{
Telerik.Reporting.Processing.SubReport subReport = (Telerik.Reporting.Processing.SubReport)sender;
if
(listId > 0 && driverId > 0 && customerId > 0 && addressId > 0)
{
AmountOfCarriers
amountOfCarriers =
DataFacade.Transport.DFCarrier.GetAmountOfCarriers(listId, driverId,
CustomerId, addressId, LanguageId, BranchId);
if
(amountOfCarriers !=
null
&& amountOfCarriers.Count > 0)
{
subTLCarriers1.SetPrivateDataMembers(Translator, LanguageId);
subTLCarriers1.DataSource = amountOfCarriers;
}
}
}
or by using the data I find for each Address-group:
private
void
groupFooterAddress_ItemDataBound(
object
sender, EventArgs e)
{
Telerik.Reporting.Processing.ReportSection addressGroupSection = ((Telerik.Reporting.Processing.ReportSection)sender);
Telerik.Reporting.Processing.Group customerGroup = ((Telerik.Reporting.Processing.Group)addressGroupSection.Parent.Parent);
Telerik.Reporting.Processing.Group driverGroup = ((Telerik.Reporting.Processing.Group)customerGroup.Parent);
TransportListDocuments docs = (TransportListDocuments)addressGroupSection.Report.DataSource;
int
selectedAddressId = ((Address)addressGroupSection.DataObject[
"Address"
]).Id;
int
selectedCustomerId = ((ObjectModel.Customer.Customer)(customerGroup.GroupHeader.DataObject[
"Customer"
])).Id;
int
selectedDriverId = ((Driver)(driverGroup.GroupHeader.DataObject[
"Driver"
])).Id;
AmountOfCarriers amountOfCarriers = DataFacade.Transport.DFCarrier.GetAmountOfCarriers(docs[0].TransportListId, selectedAddressId, selectedCustomerId, selectedDriverId, LanguageId, BranchId);
if
(amountOfCarriers !=
null
&& amountOfCarriers.Count > 0)
{
subTLCarriers1.SetPrivateDataMembers(Translator, LanguageId);
subTLCarriers1.DataSource = amountOfCarriers;
}
}
which is sufficient to me to get data for the subreport in the footer.
Only the last line of code (subTLCarriers1.DataSource = amountOfCarriers;) sets the datasource on the control on the Detail Report, not the instance of the subreport in de groupFooter, as result, I get the same subreport for ALL the groups in my Detail Report instead of a different subreport for each address-group of lines.
Could you help me find a way to set the DataSource of each instance of the subreport in the Group-Footer,
so that each Address-Group get it's own subreport in it's footer?
Any help is very much welcome since I've been struggling with this for a few days now.