I have created a report in Silverlight. The report has a string parameter that its value is set in code behind of MainPage.xaml like this:(the MainPage.xaml contains a Silverlight ReportViewer)
I want to split this parameter by comma in MyReport.cs and add "Header1", "Header2" and "Header3" to GroupHeaderSection Items of the report.
First, I write below code in the constructor method of report:
but, it didn't work and I think the reason is that the report parameter isn't set in the constructor. Moreover, I have a problem related to Location and Size of each TextBox.
Thanks,
Negin
public
MainPage()
{
InitializeComponent();
this
.ReportViewer1.RenderBegin +=
new
RenderBeginEventHandler(ReportViewer1_RenderBegin);
}
void
ReportViewer1_RenderBegin(
object
sender, RenderBeginEventArgs args)
{
args.ParameterValues.Add(
"reportParameter"
,
"Header1;Header2;Header3"
);
}
I want to split this parameter by comma in MyReport.cs and add "Header1", "Header2" and "Header3" to GroupHeaderSection Items of the report.
First, I write below code in the constructor method of report:
string
[] splitedReportParameter =
this
.ReportParameters[
"reportParameter"
].Value.ToString().Split(
','
);
for
(
int
i = 0; i < splitedReportParameter.Length; i++)
{
Telerik.Reporting.TextBox CaptionTextBox =
new
Telerik.Reporting.TextBox();
labelsGroupHeader.Items.AddRange(
new
ReportItemBase[] { CaptionTextBox });
CaptionTextBox.CanGrow =
true
;
CaptionTextBox.Name = splitedReportParameter[i] +
"CaptionTextBox"
;
CaptionTextBox.StyleName =
"Caption"
;
CaptionTextBox.Value = splitedReportParameter[i];
}
Thanks,
Negin