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

NeedDataSource event not firing when updating the ReportViewer

3 Answers 494 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 08 Jul 2009, 09:42 PM
Hello,

I upgraded to Telerik Reporting Q2 2009 and my reports are encountering an issue. I have a button on the page that sets the parameters for the report and updates the ReportViewer. However, since I upgraded to Q2 the NeedDataSource event is not firing. If I use Q1 it works fine. I have to use Q2 because Q2 has a fix regarding the page count issue.

ASPX:
1) the aspx has checkboxes and dropdowns so the user can have different options when running the report.
2) View Report button that when clicked assigns the report parameters and sets the report to the reportviewer, just like the examples.

Report NeedDataSource:
Here I would dynamically get the data and show or hide sub reports based on the parameters that were passed. I would also be able to store the previous datatable/dataset by using a global variable so that I could reuse some data if there were no change, and only generate new data that is needed.

As with Q2 the NeedDataSource event is only fired the first time the button is pressed. The second time the button is pressed, I only get to :

Public Sub New()
        InitializeComponent()
End Sub

I have also tried : Me.DataSource = Nothing after InitializeComponent() but that didnt help.

Thanks for any assistance.

3 Answers, 1 is accepted

Sort by
0
Michael Nagy
Top achievements
Rank 2
answered on 09 Jul 2009, 12:19 PM
I have the same issue , NeedDataSource evnet doesn't fired when i click refreh after change my report parameters .
here is my code snippet

        private void Default_NeedDataSource(object sender, EventArgs e) 
        { 
           this.reportTotalAnnualSalaryPerEmployeeTableAdapter1.Fill( 
                  this.totalPayrollPerEmployeeDataSet.ReportTotalAnnualSalaryPerEmployee, 
                reportParameter["Year"as int?, reportParameter["Employee"as Guid?); 
             
            this.DataSource = this.totalPayrollPerEmployeeDataSet.ReportTotalAnnualSalaryPerEmployee; 
        } 
 
please i need  help..
0
Steve
Telerik team
answered on 13 Jul 2009, 08:26 AM
Hi guys,

We've not been able to reproduce the issue you describe. Find attached a sample project where you can set report parameters from both the built-in report parameters UI and directly from your .aspx page on a button click event handler. Give it a spin and let us know what differs in your case.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Charles
Top achievements
Rank 1
answered on 15 Jul 2009, 03:04 PM
Thanks Steve, you had given me a fix in the Support ticket I had sent in.

If anyone else is looking for an answer:

In the aspx.cs page:

ReportViewer1.Report = null;
ReportViewer1.Report = report;
Tags
General Discussions
Asked by
Charles
Top achievements
Rank 1
Answers by
Michael Nagy
Top achievements
Rank 2
Steve
Telerik team
Charles
Top achievements
Rank 1
Share this question
or