Refreshing report inside dynamically created TabPanel

524 Views Asked by At

I am having a ReportViewer inside the inner TabContainer TabPanel which i generated dynamically in Page Init event. I load the report on OnActiveTabChanged event and I want to refresh the report on SelectedIndexChanged event.

How ever report doesn't change when I change the selected value of the DropDownList.

Note: I debug and the loadReport inside the SelectedIndexChanged execute properly.

Following is part of my code.

    protected void DDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList DDL = (DropDownList)sender;

        ReportViewer rptViewer = (ReportViewer)DDL.Parent.FindControl("rptDateElectricity");

        if (rptViewer == null)
        {
            rptViewer = new ReportViewer();
            rptViewer.ID = "rpt" + "Date" + "Electricity"
            rptViewer.Width = Unit.Pixel(1100);
            loadReport(rptViewer, DDL, "Electricity", "Date");
            DDL.Parent.Controls.Add(rptViewer);
        }

    }


    protected void TCInner_OnActiveTabChanged(object sender, EventArgs e)
    {     
       ..............................
       ..............................

            ReportViewer rptViewer = (ReportViewer)DDL.Parent.FindControl("rptDateElectricity");

            if (rptViewer == null)
            {
                rptViewer = new ReportViewer();
                rptViewer.ID = "rpt" + "Date" + "Electricity"
                rptViewer.Width = Unit.Pixel(1100);
                loadReport(rptViewer, DDL, "Electricity", "Date");
                loadReport(rptViewer, DDL, monitoringObject, timePeriod);
            }              

        }            
    }

I believe that this is a problem with view state.
I tried to set the EnableViewState false for the report viewer.
When i did i got the following runtime error:

"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The Update method can only be called on UpdatePanel with ID 'ReportArea' before Render." Can anybody give a solution to this.

Thanks in advanced.

1

There are 1 best solutions below

0
On

I got the same error when I told my report to autoRefresh, and it was caused by some javascript I'd inserted to override some of the ReportViewer's javascript (Microsoft.Reporting.WebFormsClient._ReportAreaAsyncLoad) to fix an error I'd been getting earlier. My custom javascript was triggering extra async load postbacks. I guess autorefresh conflicts with that.

Not sure if that's the cause of your problem though.