XtraReport1添加参数
解决了
在report有个BeforePrint事件
这里面直接
1
|
string year = this .Parameters[ "year" ].Value.ToString(); |
这样就可以获取到了
至于传参就是
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();
}
XtraReport1添加参数的更多相关文章
- RDLC中添加参数,用来显示报表中数据集之外的信息。
我添加了两个参数,首先后台: ReportParameter rp = ,,).ToString()); ReportParameter rp1 = new ReportParameter(" ...
- c#数据绑定(4)——向查询中添加参数
本实例主要练习了ADO.Net 连接到外部数据库的基础上,向查询中添加参数.使用的是ACCESS数据库. 在ACCESS数据库中可以用MSSQL的形式定义操作字符串,也可以采用OLEDB的形式. MS ...
- 在VS中向命令行添加参数的方法
在VS中向命令行添加参数的方法 在VS中向命令行添加参数,即向main()函数传递参数的方法: 右键单击要 添加参数的工程-->属性-->配置属性-->调试,在右侧“命令参数”栏输入 ...
- 技巧~向URL地址添加参数
只是个小技巧,感觉挺有用,拿出来分享一下 功能:在URL地址上添加参数,如果只有一个,会是?userid=1,需要是大于1个,会是&userid=1 实现: private string Ad ...
- Extjs中给同一个GridPanel中的事件添加参数的方法
Extjs中给同一个GridPanel中的事件添加参数的方法: this.isUse = new Ext.Action({ text:'启用', scope ...
- XgCalendar日历插件动态添加参数
在使用xgcalendar日历插件的时候,参数数组并非只有类型.显示时间.时区等这些参数,还可以根据extParam自定义参数扩展搜索条件,例如根据用户Id搜索不同用户的日历信息,需要将用户的Id存在 ...
- 关于 preHandle 重写和添加参数问题,重写HttpServletRequestWrapper和Filter
由于 preHandle 中HttpServletRequest 只有setAttribute而没有setParameter 也没有 add 方法 所以是没办法直接添加参数的.从网上查了很多资料,基本 ...
- url后面添加参数,注意&?的添加方式
// 添加参数&key=value 直接输出url function insertParam(key, value) { key = encodeURI(key); value = encod ...
- Revit Family API 添加参数与尺寸标注
使用FamilyManager其他的与普通添加参数与标注没区别. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Man ...
随机推荐
- SVN 锁定无法提交命令执行失败
有个项目使用svn 高版本客户端作业,转换到低版本的环境下,出现锁定,命令执行失败. 使用cleanup 没有效果, 网上建议的svn无法Cleanup解决方法: Step1:到 sqlite官网 ( ...
- 知乎模拟登录,支持验证码和保存 Cookies
import requests import time import re import base64 import hmac import hashlib import json import ma ...
- springBoot整合mybatis-plus关闭自动转换小驼峰命名规则
增加配置信息 mybatis-plus: configuration: map-underscore-to-camel-case: false
- ES的基本概念
elasticsearch 的索引与文档是开发关注的视角:节点.集群.分片是运维关注的视角 elasticearch 文档的介绍 - elasticearch 是面向文档的,文档是所有可搜索数据的最小 ...
- FiBiNET-学习
Our main contributions are listed as follows: • Inspired by the success of SENET in the computer vis ...
- Spring Cloud Hystrix 请求熔断与服务降级
在Java中,每一个HTTP请求都会开启一个新线程.而下游服务挂了或者网络不可达,通常线程会阻塞住,直到Timeout.你想想看,如果并发量多一点,这些阻塞的线程就会占用大量的资源,很有可能把自己本身 ...
- Jquery 获取控件的值
1:通过控件的ID 获取值 $("input[name='weiKuanDate']").val(); 2:通过控件的name 获取值 $("input[name='we ...
- [经验] Java 服务端 和 C# 客户端 实现 Socket 通信
由于项目需要, 我需要通过 Java 开发的服务端对 C# 作为脚本语言开发的 unity 项目实现控制 话不多说, 直接上代码 首先, 我们先来构建服务端的代码, 服务端我们使用 Java 语言 i ...
- [Pytorch数据集下载] 下载MNIST数据缓慢的方案
步骤一 首先访问下面的网站,手工下载数据集.http://yann.lecun.com/exdb/mnist/ 把四个压缩包下载到任意文件夹,以便之后使用. 步骤二 把自己电脑上已经下载好的数据集的文 ...
- error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation
遇到这个问题,请打开项目的Properties(属性)------->Configuration Properties(配置属性)------>C/C++ ------>Prepro ...