this.DataSource = new List<Test>()
{
new Test(){Name = "hasan"},
new Test(){Name = "Ali"}
};
3rd report just contains two sub report objects in its detail section.
When I run the application I see only one of the sub reports. Can someone check the source at http://www.filedropper.com/telerikreporttest and tell me what the problem is?
If I check preview of individual report, they show the data perfectly fine but something wrong happens on runtime.
Also the behavior seems unpredictable because sometimes it shows data from both the reports but repeats the static text as many times as there are rows in the second subreport. This happens if I change the order of subreports in the detail seciton of Master report.
Thanks
/// <summary>
/// Initializes a new instance of the <see cref = "OverviewReportBase{T}" /> class.
/// </summary>
public
OverviewReportBase()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
// Set DataSource to null, so that the NeedDataSource Event gets fired.
// This is done because otherwise the ReportParameters are not getting filled from the Silverlight Client.
// see a comment on http://blogs.telerik.com/blogs/posts/09-12-07/programmatic_initialization_of_report_parameter_values_in_telerik_reporting_silverlight_viewer.aspx for more information
DataSource =
null
;
}
OnNeedDataSource method:
/// <summary>
/// Called when the report needs a data source.
/// </summary>
/// <param name = "sender">The sender.</param>
/// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
protected
override
void
OnNeedDataSource(Object sender, EventArgs e)
{
Unit writeableArea = CalculateWidthOfWriteableArea();
IEnumerable<String> columnNames = ((Object[]) ReportParameters[
"columnNames"
].Value).OfType<String>();
Int32 columnCount = columnNames.Count();
IEnumerable<Int32> columnPercentages =
((Object[]) ReportParameters[
"columnPercentages"
].Value).Select(x => Int32.Parse(x.ToString()));
Double summedUpWidth = 0D;
for
(Int32 i = 0; i < columnCount; i++)
{
Unit controlWidth = writeableArea.Multiply(columnPercentages.ElementAt(i)).Divide(100);
TextBox captionTextBox =
new
TextBox
{
Location =
new
PointU(
new
Unit(summedUpWidth, UnitType.Mm),
new
Unit(0, UnitType.Cm)),
Size =
new
SizeU(controlWidth,
new
Unit(0.75, UnitType.Cm)),
Name =
String.Format(CultureInfo.InvariantCulture,
"captionTextBox{0}"
, i),
StyleName =
"Caption"
,
TextWrap =
false
,
Value = RetrieveDisplayName(columnNames.ElementAt(i))
};
labelsGroupHeader.Items.Add(captionTextBox);
TextBox dataTextBox =
new
TextBox
{
Location =
new
PointU(
new
Unit(summedUpWidth, UnitType.Mm),
new
Unit(0, UnitType.Cm)),
Size =
new
SizeU(controlWidth,
new
Unit(0.75, UnitType.Cm)),
Name = String.Format(CultureInfo.InvariantCulture,
"dataTextBox{0}"
, i),
StyleName =
"Data"
,
TextWrap =
false
,
Value = RetrieveValuePathOfColumn(columnNames.ElementAt(i))
};
detail.Items.Add(dataTextBox);
summedUpWidth += controlWidth.Value;
}
SetDataSourceHere();
base
.OnNeedDataSource(sender, e);
}
Best Regards
public
Order.OrderMetaData cmd {
get
;
set
; }
public
IList<OrderDetail.OrderDetailMetaData> ligneCmd {
get
;
set
; }
I have a report with three subreports. The FilesAttached subreport is working, but the other two subreports do not show any data. Here is my binding code. Is there something I am missing? Where else should I look?
Dim summaryReport As New telSummaryReport
summaryReport.DataSource = DS.Tables("SCR")
summaryReport.subNotes.ReportSource.DataSource = DS.Tables("Notes")
summaryReport.subFilesAttached.ReportSource.DataSource = DS.Tables("Files")
summaryReport.subCCB.ReportSource.DataSource = DS.Tables("Decisions")
Dim reportProcessor As Telerik.Reporting.Processing.ReportProcessor = New Telerik.Reporting.Processing.ReportProcessor()
Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", summaryReport, Nothing)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ContentType = result.MimeType
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Private)
HttpContext.Current.Response.Expires = -1
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", filename))
HttpContext.Current.Response.BinaryWrite(result.DocumentBytes)
HttpContext.Current.Response.End()