解决了
在report有个BeforePrint事件
这里面直接
C# code

 

?

1
string year = this.Parameters["year"].Value.ToString();
这样就可以获取到了
至于传参就是
C# code

 

?

1
2
3
4
5
6
ReportPreviewModel model = new ReportPreviewModel("../ReportService1.svc");
model.ReportName = "SLA_Manage_TrafficSafety.Web.HarborReport";
model.Parameters["year"].Value = txtYear.Text; //参数
model.AutoShowParametersPanel = false//隐藏参数面板
documentPreview1.Model = model;
model.CreateDocument();

 


using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Parameters;
// ... private void simpleButton1_Click(object sender, EventArgs e) {
// Create a report instance.
XtraReport1 report = new XtraReport1(); // Create a parameter and specify its name.
Parameter param1 = new Parameter();
param1.Name = "CatID"; // Specify other parameter properties.
param1.Type = typeof(System.Int32);
param1.Value = 1;
param1.Description = "Category: ";
param1.Visible = true; // Add the parameter to the report.
report.Parameters.Add(param1); // Specify the report's filter string.
report.FilterString = "[CategoryID] = [Parameters.CatID]"; // Force the report creation without previously
// requesting the parameter value from end-users.
report.RequestParameters = false; // Show the parameter's value on a Report Header band.
XRLabel label = new XRLabel();
label.DataBindings.Add(new XRBinding(param1, "Text", "Category: {0}"));
ReportHeaderBand reportHeader = new ReportHeaderBand();
reportHeader.Controls.Add(label);
report.Bands.Add(reportHeader); // Assign the report to a ReportPrintTool,
// to hide the Parameters panel,
// and show the report's print preview.
ReportPrintTool pt = new ReportPrintTool(report);
pt.AutoShowParametersPanel = true;
pt.ShowPreviewDialog();
}

最新文章

  1. 《java中异常和错误》
  2. Web Service 通过BinaryFormatter序列化和反序列化泛型List
  3. 上传图片HTML <form> 标签的 method 属性
  4. Hadoop入门进阶课程4--HDFS原理及操作
  5. Android自动更新安装后显示‘完成’‘打开’按钮
  6. EntityManager方法简介
  7. java 2 8 10 16
  8. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.5.5
  9. JSON.parse和JSON.stringify 参数详解
  10. 日志分析工具-ApexSQL介绍
  11. 无限分级Repeater递归实现:读取一次数据库,使用LINQ2SQL技术,支持排序&显示隐藏
  12. 使用redis可能出现的问题
  13. 使用 JavaScript 将网站后台的数据变化实时更新到前端
  14. TensorFlow学习笔记:保存和读取模型
  15. Session 在分布式系统中实现方式
  16. 2016 多校联赛7 Balls and Boxes(概率期望)
  17. calico 排错记录 apt-get install telnet
  18. BZOJ.3498.[PA2009]Cakes(三元环 枚举)
  19. WCF RestFull提交数据超出限额解决方法
  20. ldconfig是一个动态链接库管理命令

热门文章

  1. 《Interest Rate Risk Modeling》阅读笔记——第八章:基于 LIBOR 模型用互换和利率期权进行对冲
  2. WPF 体系结构
  3. ThinkPHP6源码分析之应用初始化
  4. 19年读100本书之第二本--《OKR工作法》-克里斯蒂娜 沃特克
  5. day3-1函数
  6. spring boot 中容器 Jetty、Tomcat、Undertow
  7. Duilib热键
  8. 图解jvm--(三)类加载与字节码技术
  9. 「CF1037D」Valid BFS?
  10. RF之目录结构、执行参数、用例标签 -6