在动态创建的 TabPanel 中刷新报告
我在内部 TabContainer TabPanel 中有一个 ReportViewer,它是我在 Page Init 事件中动态生成的。 我加载 OnActiveTabChanged 事件的报告,并且想刷新 SelectedIndexChanged 事件的报告。
当我更改 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 运行时错误: Sys.WebForms.PageRequestManagerServerErrorException:更新 方法只能在 ID 为“ReportArea”的 UpdatePanel 上调用 渲染。”任何人都可以解决这个问题。
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我告诉我的报告自动刷新时,我遇到了同样的错误,这是由我插入的一些 JavaScript 引起的,这些 JavaScript 是为了覆盖 ReportViewer 的一些 JavaScript (Microsoft.Reporting.WebFormsClient._ReportAreaAsyncLoad) 以修复我之前遇到的错误。我的自定义 JavaScript 触发了额外的异步加载回发。我猜自动刷新与此冲突。
但不确定这是否是您问题的原因。
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.