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

NeedDataSource and ItemDataBinding are firing only once

1 Answer 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Predrag
Top achievements
Rank 1
Predrag asked on 06 Oct 2015, 07:33 AM

I'm changing my report parameter through NeedDataSource or ItemDataBinding events but these events are firing only once? Why? It fires only when the report is generated the first time.

The event looks like

private void rptKomplet_NeedDataSource(object sender, EventArgs e)

{

Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

this.sqlDataSource1.Parameters["@some_param"].Value = <here comes param from controller>;

report.DataSource = sqlDataSource1;

}​

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 08 Oct 2015, 12:08 PM
Hello Predrag,

The report events are fired during report processing. (Understanding EventsReport Life Cycle). Depending on your specific scenario the events might not be fired after the first time you load the report.
For example, you might be retrieving a cached version of the report, which has already been processed and rendered.
Also, note that it is not recommended to access the report definition in events:
//incorrect
this.sqlDataSource1.Parameters...
 
//correct
var report = (Telerik.Reporting.Processing.Report)sender;
var ds = (Telerik.Reporting.SqlDataSource)report.DataSource;
ds.Parameters...


Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Predrag
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or