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