0

I am very new to Telerik Reporting as well as MVC. I am using Telerik Reporting Q1 2013 and MVC 4. I want to pass some info as parameter to report. I tried by sending parameter from code behind of report, but no use. It showing all record.

What I have done is

public partial class ImmunizationRpt : Telerik.Reporting.Report
{
    public ImmunizationRpt()
    {

        InitializeComponent();

        Telerik.Reporting.ReportParameter param = new ReportParameter();
        param.Name = "PatientKey";
        param.Type = ReportParameterType.Integer;
        param.AllowBlank = false;
        param.AllowNull = false;
        param.Value = 1;
        param.Visible = true;
        this.Report.ReportParameters.Add(param);
        //this.Report.ReportParameters.Add("PatientKey",ReportParameterType.Integer,1);
    }
}
4

2 回答 2

1

如果该参数已在报表中定义,您可以通过集合访问它。

this.Report.ReportParameters["PatientKey"].Value = 1;
于 2013-09-16T17:53:31.773 回答
0

谢谢你的回复!我已经实现了这一点,因为
我的报告显示了所有记录,因为我没有将报告设置为根据参数值过滤记录。为了实现这一点,首先我们需要从后面的代码中添加新参数(就像我一样),然后我们需要添加一个新的过滤器,如下面的代码所示:

Telerik.Reporting.Filter filter1 = new Telerik.Reporting.Filter();
 filter1.Expression = "=Fields.PatientKey";
 filter1.Operator = Telerik.Reporting.FilterOperator.Equal;
 filter1.Value = "=Parameters.PatientKey.Value";
 report.Filters.Add(filter1);
于 2013-09-17T11:30:26.633 回答