asp.net报表与参数传递
来源:互联网 发布:木工简易算法 编辑:程序博客网 时间:2024/05/17 15:57
1.首先 新建数据集xsd
2.新建报表,并通过数据集布局报表rpt文件
3.添加报表控件
4.给报表绑定数据源
后台方法:
private void PoReportPrint()
{
DataSet ds = this.GetPrintData(); //报表数据源
CrystalReportSource1.ReportDocument.Load(Server.MapPath( "CryMovePathRpt.rpt "));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
if (ds.Tables[0].Rows.Count <= 0)
{
Response.Write( " <script language= 'javascript '> alert( '没有找到相关的记录! '); </script> ");
return;
}
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
}
参数传递:
protected void Page_Load(object sender, EventArgs e)
{
//获取参数列表
ParameterFields pfs = CrystalReportViewer1.ParameterFieldInfo;
//定义一个参数字段
ParameterField CustomerID = new ParameterField();
CustomerID.Name = "CustomerID";//对应报表上参数
//为参数字段指定参数值
ParameterDiscreteValue customerIDValue = new ParameterDiscreteValue();
customerIDValue.Value = Request.QueryString["CustomerID"];//为参数字段指定参数值
CustomerID.CurrentValues.Add(customerIDValue);
//向报表的参数字段添加参数
pfs.Add(CustomerID);
}
- asp.net报表与参数传递
- Android与Asp.net webApi参数传递
- ASP.net传递参数
- asp.net参数传递
- ASP.NET参数传递总结
- ASP.NET参数传递总结
- asp.net与js传递中文参数的问题
- javascript 与asp.net 传递url参数 乱码
- asp.net(C#) 与 flash 传递参数DES加密解密
- VS.Net中向报表模板中传递参数与公式
- 报表与页面一起传递参数给报表
- asp.net 页面间参数传递
- ASP.NET页面间参数传递
- asp.net之页面参数传递
- asp.net hyperlink传递两个参数
- ASP.NET页面间参数的传递
- asp.net中 传递网页参数
- ASP.NET网页间传递参数
- 跟美女上床和次贷危机
- GridView CSS样式
- GridView控件RowDataBound事件中获取列字段的几种途径
- N年,依旧。
- 北京预留一篇
- asp.net报表与参数传递
- XnView 1.95.4 正式版
- Hibernate3连接池配置
- 十句平凡但值很深思的话
- Beijing onsite scl version 1
- Entity Framework – Update Model From Database, Part 2
- Windows环境下Unicode编程总结
- 利用C#在SQL Server2000存取图像
- Boost学习(二)