我在頁面初始化事件中動態生成的內部TabContainer TabPanel內部有一個ReportViewer。 我加載OnActiveTabChanged事件的報告,我想刷新SelectedIndexChanged事件的報告。動態創建的TabPanel裏面刷新報表
當我更改DropDownList的選定值時,報表不會發生變化。
注意:我調試並且SelectedIndexChanged中的loadReport正確執行。
以下是我的代碼的一部分。
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);
}
}
}
我相信這是一個視圖狀態的問題。
我試圖爲報告查看器設置EnableViewState false
。
當我做我得到以下運行時錯誤:
"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.
在先進的感謝。