Parameters from our GUI and Refresh Report.

5 posts, 0 answers
  1. Dmitry Boltrushko
    Dmitry Boltrushko avatar
    2 posts
    Member since:
    Aug 2009

    Posted 19 Aug 2009 Link to this post

    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.
  2. AkAlan
    AkAlan avatar
    121 posts
    Member since:
    Jun 2009

    Posted 20 Aug 2009 Link to this post

    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
  3. DevCraft banner
  4. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 21 Aug 2009 Link to this post

    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.
  5. Dmitry Boltrushko
    Dmitry Boltrushko avatar
    2 posts
    Member since:
    Aug 2009

    Posted 24 Aug 2009 Link to this post

    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.  
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 27 Aug 2009 Link to this post

    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.
Back to Top
DevCraft banner