在动态创建ASP.NET报表查看器Web控制问题 [英] Problem in dynamically creating ASP.NET report viewer web control
本文介绍了在动态创建ASP.NET报表查看器Web控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要动态地创建ASP.NET报表查看器Web控件,但得到下面的异常:
I want to dynamically create an ASP.NET report viewer web control, but got the exception below:
报表查看器Web控制,需要在网络表单上System.Web.UI.ScriptManager。
The Report Viewer Web Control requires a System.Web.UI.ScriptManager on the web form.
下面是我的code:
Microsoft.Reporting.WebForms.ReportViewer viewer = new Microsoft.Reporting.WebForms.ReportViewer();
viewer.ServerReport.ReportServerUrl = "server url";
viewer.ServerReport.ReportPath = "reprot path";
System.Web.UI.ScriptManager scriptManager = new ScriptManager();
Page page = new Page();
System.Web.UI.HtmlControls.HtmlForm form = new HtmlForm();
form.Controls.Add(scriptManager);
form.Controls.Add(viewer);
page.Controls.Add(form);
page.DataBind(); //exception here
任何想法将非常AP preciated。
Any idea would be very much appreciated.
推荐答案
尝试添加下面的标记到你的ASPX页面:
Try adding the following tag to your aspx page:
<asp:ScriptManager id='scriptManager' runat='server' />
这篇关于在动态创建ASP.NET报表查看器Web控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文