后台动态调用报表

关于Asp.net自带的报表有很多应用的方法,下面只是我在做项目过程中,所应用到的一部内容,仅以此记录一下。
若是有想深入学习的朋友,还请看Msdn。
前台设计
<% @ Register Assembly = " Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a "
    Namespace
= " Microsoft.Reporting.WebForms "  TagPrefix = " rsweb "   %>
< rsweb:ReportViewer ID = " rvResultStatistics "  runat = " server "  Font - Names = " Verdana "  
        Font
- Size = " 8pt "  InteractiveDeviceInfos = " (集合) "  WaitMessageFont - Names = " Verdana "  
        WaitMessageFont
- Size = " 14pt "  PageCountMode = " Actual "  Width = " 893px "  
        Height
= " 504px "  ShowBackButton = " False " >
</ rsweb:ReportViewer >

前台设计如图所示

后台代码如下:

 

                string  dt  =   " % "   +  ddlYear.SelectedValue.ToString()  +   " % " ;
                domain 
=  Helper.CheckLog().SelectCheckLog(dt);
                
if  (ddlReportSort.SelectedItem.Text  ==   " 饼状图 " )
                {
                    
// 设置数据源
                    ReportDataSource rds  =   new  ReportDataSource( " DataSet1 " , domain);
                    
this .rvResultStatistics.LocalReport.DataSources.Clear();
                    
this .rvResultStatistics.LocalReport.DataSources.Add(rds);
                }
                
else
                {
                    ReportDataSource rds 
=   new  ReportDataSource( " RptByDateHistogramDataSet " , domain);
                    
this .rvResultStatistics.LocalReport.DataSources.Clear();
                    
this .rvResultStatistics.LocalReport.DataSources.Add(rds);
                }

                
// 指定报表文件路径
                 this .rvResultStatistics.LocalReport.ReportPath  =   " ../Reports/ "   +  ddlReportSort.SelectedValue.ToString();
                
this .rvResultStatistics.DataBind();


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值