Question

i want to pass Log ind person id as parameter to telerik report Q1 2013 using mvc 4 vs 2012.and i don't want send parameter through UI parameter. what i have done on aspx view is

<script runat="server">
    public override void VerifyRenderingInServerForm(Control control)
     {
      // to avoid the server form (<form runat="server"> requirement
      }
     protected override void OnLoad(EventArgs e)
      {
         base.OnLoad(e);
          var report = new ImmunizationRpt();
          var instanceReportSource = new Telerik.Reporting.InstanceReportSource();
           instanceReportSource.ReportDocument = report;
          report.ReportParameters.Add("PatientKey",Telerik.Reporting.ReportParameterType.Integer, 1);
         ReportViewer1.ReportSource = instanceReportSource;

         ReportViewer1.RefreshReport();
  }
</script>

but report shows all record.it not getting filter record.

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top