I'm generating a report, getting the data from a sproc. I assigned the result of the sproc to Data Source of my report, and I'm able to et data when binding the report and tables, but before rendering the report the Data Source is deleted and not data is shown in the report.
Private Sub EmployeeComplianceStatement_NeedDataSource(sender As Object, e As EventArgs) Handles Me.NeedDataSource Dim ContractID As Integer? = Me.ReportParameters("ContractID").Value Dim EmployeeID As Integer = Me.ReportParameters("EmployeeID").Value Dim StartMonth As Integer = Me.ReportParameters("StartMonth").Value Dim StartYear As Integer = Me.ReportParameters("StartYear").Value Dim EndMonth As Integer = Me.ReportParameters("EndMonth").Value Dim EndYear As Integer = Me.ReportParameters("EndYear").Value DS = EmployeeBenefitsManager.GetEmployeeBenefitsCompliance(ContractID, EmployeeID, StartMonth, StartYear, EndMonth, EndYear) Dim pageHeader = TryCast(Report.Items.Find("pageHeaderSection1", True)(0), Telerik.Reporting.PageHeaderSection) Dim txtNodata = TryCast(pageHeader.Items.Find("txtNoData", True)(0), Telerik.Reporting.TextBox) If DS.Length = 0 Then txtNodata.Visible = True Else txtNodata.Visible = False End If Report.DataSource = DS End SubPrivate Sub Table1_NeedDataSource(sender As Object, e As EventArgs) Dim Table1 As Telerik.Reporting.Processing.Table = DirectCast(sender, Telerik.Reporting.Processing.Table) Table1.DataSource = DS End Sub Private Sub Table2_NeedDataSource(sender As Object, e As EventArgs) Dim Table2 As Telerik.Reporting.Processing.Table = DirectCast(sender, Telerik.Reporting.Processing.Table) Table2.DataSource = DS End Sub Private Sub Table3_NeedDataSource(sender As Object, e As EventArgs) Dim Table3 As Telerik.Reporting.Processing.Table = DirectCast(sender, Telerik.Reporting.Processing.Table) Table3.DataSource = DS End Sub
From what I can see, in the EmployeeComplianceStatement_NeedDataSource event, the Report is accessed directly through the Report.DataSource property. This is not expected to work because, in current releases, modifying report items in the report event should change the Telerik.Reporting.Processing element sent in the sender object, exactly what is done with the tables in the other 3 NeedDataSource events.
Basically, the sender needs to be DirectCasted to Telerik.Reporting.Processing.Report type and then you may edit the DataSource of the processing report.
For more information, please read the Changes on items in report events are not applied KB article.