locked
populating a localreport on page load RRS feed

  • Question

  • User2000283796 posted

    I have reportviewer controls running in local mode.  These are being controlled successfully by cascading dropdownlists.  I now wish to initialise the reportviewer controls by assigning a report and a datatable on page load.  However, the viewer is being left blank.

    The code in page_load is:

                                        ReportViewer rV1 = ReportViewerTopLeft;
                                        DataSetX01ATableAdapters.vwExtract02_StockCountEaTableAdapter tA1;
                                        tA1 = new DataSetX01ATableAdapters.vwExtract02_StockCountEaTableAdapter();
                                        DataSetX01A.vwExtract02_StockCountEaDataTable newSCTable1;
                                        newSCTable1 = tA1.GetDataX01A("All", "All", "All", "All");
                                        rV1.LocalReport.ReportPath = "ReportX01.rdlc";
                                        DataTable dt1 = (DataTable)newSCTable1;
                                        rV1.LocalReport.DataSources.Clear();
                                        rV1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt1));
    This is basically the same as is used by the cascadingdropdown lists except the parameter values and the report name are hard coded.

    Any thoughts on the problem?

    Ken

    Monday, August 6, 2012 3:40 PM

Answers

  • User384031199 posted

    Hi,

    Try the below code.

    rV1.LocalReport.Refresh();

    Hope this helps.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 6, 2012 10:06 PM

All replies

  • User384031199 posted

    Hi,

    Try the below code.

    rV1.LocalReport.Refresh();

    Hope this helps.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 6, 2012 10:06 PM
  • User2105670541 posted

    right, use it:

    rV1.LocalReport.Refresh();

    Tuesday, August 7, 2012 12:59 AM
  • User2000283796 posted

    Thanks.

    You are right that this line was missing.  There were a couple of other problems to do with parameters.

    What made me miss the obvious points was that it remains the case that there is a problem with a report viewer sometimes failing to render.  I don't know whether this is a problem others have found.

    Ken

    Tuesday, August 7, 2012 2:33 AM