解决了
在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();
}

XtraReport1添加参数的更多相关文章

  1. RDLC中添加参数,用来显示报表中数据集之外的信息。

    我添加了两个参数,首先后台: ReportParameter rp = ,,).ToString()); ReportParameter rp1 = new ReportParameter(" ...

  2. c#数据绑定(4)——向查询中添加参数

    本实例主要练习了ADO.Net 连接到外部数据库的基础上,向查询中添加参数.使用的是ACCESS数据库. 在ACCESS数据库中可以用MSSQL的形式定义操作字符串,也可以采用OLEDB的形式. MS ...

  3. 在VS中向命令行添加参数的方法

    在VS中向命令行添加参数的方法 在VS中向命令行添加参数,即向main()函数传递参数的方法: 右键单击要 添加参数的工程-->属性-->配置属性-->调试,在右侧“命令参数”栏输入 ...

  4. 技巧~向URL地址添加参数

    只是个小技巧,感觉挺有用,拿出来分享一下 功能:在URL地址上添加参数,如果只有一个,会是?userid=1,需要是大于1个,会是&userid=1 实现: private string Ad ...

  5. Extjs中给同一个GridPanel中的事件添加参数的方法

    Extjs中给同一个GridPanel中的事件添加参数的方法: this.isUse = new Ext.Action({            text:'启用',            scope ...

  6. XgCalendar日历插件动态添加参数

    在使用xgcalendar日历插件的时候,参数数组并非只有类型.显示时间.时区等这些参数,还可以根据extParam自定义参数扩展搜索条件,例如根据用户Id搜索不同用户的日历信息,需要将用户的Id存在 ...

  7. 关于 preHandle 重写和添加参数问题,重写HttpServletRequestWrapper和Filter

    由于 preHandle 中HttpServletRequest 只有setAttribute而没有setParameter 也没有 add 方法 所以是没办法直接添加参数的.从网上查了很多资料,基本 ...

  8. url后面添加参数,注意&?的添加方式

    // 添加参数&key=value 直接输出url function insertParam(key, value) { key = encodeURI(key); value = encod ...

  9. Revit Family API 添加参数与尺寸标注

    使用FamilyManager其他的与普通添加参数与标注没区别. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Man ...

随机推荐

  1. 5种JVM调优配置方法概览

    1 堆设置 -Xms:初始堆大小 -Xmx:最大堆大小 -XX:NewSize=n:设置年轻代大小 -XX:NewRatio=n:设置年轻代和年老代的比值.如:为3,表示年轻代与年老代比值为1:3,年 ...

  2. ScrollView不设置contentSize属性依然也可以作为底层滚动View(使用masonry设置scrollView的contentSize)

    第一步 //下层的scroolView self.baseScrollView = [[UIScrollView alloc] init]; self.baseScrollView.delegate ...

  3. 为小学生出四则运算题目.java

    import java.util.Scanner; import java.util.Random; public class test{ public static int s1 = new Ran ...

  4. CentOS7.3下载地址

    CentOS 7.3,是CentOS-7系列的第四个发行版本,官方版本号为7.3.1611.该版本的安装映像只有 64 位,具体的安装映像有以下几种: DVD版 推荐(迅雷下载):http://arc ...

  5. 1 CSS简介&语法&选择器及优先级&背景&文本&字体&链接&列表&表格

    什么是CSS? Cascading Style Sheets层叠样式表,样式定义如何显示HTML元素 样式通常存储于样式表中,外部样式表通常存储在CSS文件中 多个样式定义可层叠为1,样式对网页中元素 ...

  6. 学习笔记(2)- BioBERT

    Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, Jaewoo Kang, BioBERT: ...

  7. 线程安全Collections.synchronizedList

    ollections.synchronizedList引发的线程安全问题 有些容器是线程安全的(Vector,ConcurrentLinkedQueue等),有些则不是(list等),利用类 似 pr ...

  8. CSS - 布局流程

    一.为了提高网页制作的效率,布局时通常需要遵守一定的布局流程,具体如下: "版心"(可视区) 是指网页中主体内容所在的区域.一般在浏览器窗口中水平居中显示,常见的宽度值为960px ...

  9. 利用TPL(任务并行库)构建Pipeline处理Dataflow

    https://www.cnblogs.com/CoderAyu/p/9757389.html

  10. (二)Buildroot介绍

    详情请参考: http://www.buildroot.org/downloads/manual/manual.html 参考博客: https://www.cnblogs.com/arnoldlu/ ...