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

Parameters from our GUI and Refresh Report.

4 Answers 277 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dmitry Boltrushko
Top achievements
Rank 1
Dmitry Boltrushko asked on 19 Aug 2009, 01:38 PM
Hi, guys.

I have the following scenario.

My report has 2 parameters and uses NeedDataSoure event. In this event I get DataTable with my data and assign to DataSource property of the report. On the page where ReportViewer is I have UI for my 2 parameters and a button. Click event of this button assigns parameters for my report.

As the result I see my report but without data bound in details section. DataTable contains data (check while debugging) for sure but not bound. When I hit Refresh, all is fine.

I've seen this schenario in some video tutorial and there in click event handler was a call of ReportViewer.RefreshReport method. But I cannot find this method now in web form ReportViewer for Q2 2009. Is it replaced by some new one?

Please advise.

4 Answers, 1 is accepted

Sort by
0
AkAlan
Top achievements
Rank 2
answered on 20 Aug 2009, 04:46 PM
I had a similar problem but I didn't use the NeedDataSource event. Anyway check out my solution, it might give you an Idea. Good Luck.

How to pass a parameter to a report SqlDataAdapter
0
Hrisi
Telerik team
answered on 21 Aug 2009, 03:31 PM
Hello Dmitry Boltrushko,

You say "... and assign to DataSource property of the report". In the event handler you should set the DataSource property of the processing report. Please, see this topic from our help for more details.

If this is not the case, please do not hesitate to contact us again.

Best wishes,
Hrisi
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
Dmitry Boltrushko
Top achievements
Rank 1
answered on 24 Aug 2009, 11:44 AM
Hi,

I think the problem is in parameters collection. I read somewhere in documentation that if some report parameter is visible then parameters area is shown and the report is not generated until you hit 'Preview'. But I have all parameters invisible and they have default values. So I want to generate my report as soon as I clicked the button on my UI. So, if I use NeedDataSource then the report is not databound. It seems like some inconsistency or bug.

I followed the Alan's advice and it worked. I moved parameters assignment and data retrieval into the report constructor. And now click event handler of my button looks like this (pseudocode):

MyReport report = new MyReport();
// Assign parameters from my UI
ReportViewer1.Report = report;

In my first attempts the report property was filled in declaratively and click handler had only parameters assignment.

Thanks.  
0
Steve
Telerik team
answered on 27 Aug 2009, 07:59 AM
Hi Dmitry,

RefreshReport method for the web report viewer has been introduced in the Q2 SP1 version (v. 3.1.9.807). For versions prior to that you can try the following:

MyReport report = new MyReport();
// Assign parameters from my UI
ReportViewer1.Report  = null;
ReportViewer1.Report = report;

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Dmitry Boltrushko
Top achievements
Rank 1
Answers by
AkAlan
Top achievements
Rank 2
Hrisi
Telerik team
Dmitry Boltrushko
Top achievements
Rank 1
Steve
Telerik team
Share this question
or