using Syncfusion.Windows.Reports;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Windows;
using LorikeetDataLib;
namespace LorikeetWPF
{
/// <summary>
/// Interaction logic for AddressReportWindow.xaml
/// </summary>
public partial class AddressReportWindow : Window
{
private LorikeetAppEntities context = new LorikeetAppEntities();
public string birthday1;
public string birthday2;
public AddressReportWindow()
{
InitializeComponent();
}
private void addressViewer_Loaded(object sender, RoutedEventArgs e)
{
try
{
context.Members.Load();
var address = from a in context.Members.Local
where a.ReceiveNewsletter == true
orderby a.Surname descending
select a;
addressViewer.ReportPath = System.IO.Directory.GetCurrentDirectory() + "\\Reports\\MailingLabels.rdl";
addressViewer.DataSources.Clear();
addressViewer.DataSources.Add(new ReportDataSource { Name = "DataSetMemberAddress", Value = address });
addressViewer.RefreshReport();
}
catch (Exception ex)
{
MessageBox.Show(MiscStuff.GetAllMessages(ex));
}
}
private void addressViewer_ReportLoaded(object sender, EventArgs e)
{
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter();
parameter.Name = "ReportParameterBirthday1";
parameter.Values.Add(birthday1);
//Add parameter
parameters.Add(parameter);
ReportParameter parameter2 = new ReportParameter();
parameter2.Name = "ReportParameterBirthday2";
parameter2.Values.Add(birthday2);
//Add parameter
parameters.Add(parameter2);
addressViewer.SetParameters(parameters);
}
}
}
For some reason this worked in earlier versions of Syncfusion but now it is broken. When i try and view the report it says it hasnt got the parameters.
Please help :)
Attachment:
MailingLabels_df984122.zip