Question

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);
    }
}
Was it helpful?

Solution 2

thank you for reply! i have achived this as
my report was showing all records, because i hadn't set the report to filter the records based on the parameter value. To achieve that, first we need to add the new parameter from the code behind (as i did) and then we need to add a new filter as shown in the following code:

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);

OTHER TIPS

If the parameter is already defined in the report, you can access it through the collection.

this.Report.ReportParameters["PatientKey"].Value = 1;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top