2013-08-04 152 views
0

我正在研究ASP.NET MVC 4应用程序。 Telerik Reporting被选为报告生成工具。生成报告已经有几天的时间了。这里是场景:Telerik报告分页

有一个ReportModel类提供所需的属性绑定到报告。

public class NewReportModel 
{ 
    public string ReprotTitle { get; set; } 
    public List<Product> Products { get; set; } 
    public double ReportSum { get; set; } 
} 

如上所示,有必须被显示在与分页细节部分属性的通用列表属性,因此,我必须使用TextBox控件如表不支持分页。 (根据我通过浏览网页和Telerik博客获得的)。

ReportTitle道具也应显示在每个页面的顶部,并在报告的每一页底部ReportSum

在另一方面,我申请的ObjectDataSource控件及其数据成员返回型NewReportModel的一个实例。报表设计器数据源绑定到提到的ObjectDataSource。到此为止,我可以在Report上显示ReportTitle和ReportSum道具。

问题是,我该如何获得带有分页的报表查看器上显示的产品列表?

我试图使用表并将其DataSource绑定到列表,并将表TextBox表达式绑定到“= Fields.Name”。但这不是所需要的,因为它不会带来分页。我也尝试使用SubReport,但又没有分页。

我明确指HTML分页,ReportViewer控件分页,而不是导出PDF分页。

我该如何解决这个问题?

由于提前, 阿里,

回答

0

我发现我自己的答案,希望它可以帮助别人太:

private void TheSecondReport_ItemDataBinding(object sender, EventArgs e) 
    { 
     var reportParamTitle = new ReportParameter 
           { 
            Name = "Title", 
            Value = "Report Title", 
            Type = ReportParameterType.String 
           }; 
     var reportParamSummation = new ReportParameter 
     { 
      Name = "Summation", 
      Value = 46464646, 
      Type = ReportParameterType.Integer 
     }; 

     textBox2.Value = reportParamTitle.Value as string; 
     textBox3.Value = reportParamSummation.Value.ToString(); 
    }