您好!在Webviewer上显示页上也是一样可以的
主要代码:
- public partial class WebForm1 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath(@"动态数据源.rdlx")));
- rpt.Report.ReportParameters[0].DefaultValue.Values.Add("12");
- rpt.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(locatedate);
- this.WebViewer1.Report = rpt;
- }
- private void locatedate(object sender, GrapeCity.ActiveReports.LocateDataSourceEventArgs args)
- {
- if (args.DataSourceName == "DataSource1")
- {
- if (args.DataSetName == "DataSet1")
- {
- args.Data = returndata();
- }
- }
- }
- private DataTable returndata()
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("产品编号");
- dt.Columns.Add("产品名称");
- dt.Columns.Add("单价");
- dt.Columns.Add("库存量");
- ////dt.Rows.Add("A001", "苹果", 10, 300);
- ////dt.Rows.Add("A002", "葡萄", 20, 200);
- ////dt.Rows.Add("A003", "香蕉", 30, 400);
- return dt;
- }
复制代码
|