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

Chart's NeedDataSource Event

1 Answer 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 14 Oct 2011, 04:12 PM
Hi there, I need to access the value of a subreports parameter inside the NeedDataSource event. How is this best accomplished?

I have tried the following but the value never changes:
private void chart1_NeedDataSource(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
    Telerik.Reporting.Chart chart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
 
    chart.ChartTitle.TextBlock.Text = chart.Report.ReportParameters["Branch"].Value.ToString();
}

When I have a Databind event for a textbox I can the following:
private void textBox3_ItemDataBinding(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.TextBox procTB = (Telerik.Reporting.Processing.TextBox)sender;
    Telerik.Reporting.TextBox tb = (Telerik.Reporting.TextBox)procTB.ItemDefinition;
 
    tb.Value = "= Parameters.Branch.Value";
}
This works but how can I get the parameter's value into string object?

Regards,
Christian

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 19 Oct 2011, 02:16 PM
Hi Christian,

We have noticed in the provided code snippet that you have used the Report Parameter definition item instead of the processing counterpart. The definition report parameter value is actually the default value. The sender of the event is always the processing counterpart of the data item and you can use it to access the processing report parameter. For more information check out the Using Report Parameters programmatically. Additionally you may find useful Report Events help articles.

Greetings,
Peter
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

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