Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =Fields!Name.Value.FirstName
- namespace ReportTest
- {
- public class ClientItem
- {
- public int Id { get; set; }
- public ClientName Name { get; set; }
- }
- public class ClientName
- {
- public ClientName(string first, string last)
- {
- FirstName = first;
- LastName = last;
- }
- string FirstName { get; set; }
- string LastName { get; set; }
- }
- public partial class Form1 : Form
- {
- private List<ClientItem> clients = new List<ClientItem>();
- public Form1()
- {
- InitializeComponent();
- PopulateLists();
- GenerateReport();
- }
- private void PopulateLists()
- {
- clients.Add(new ClientItem { Id = 1, Name = new ClientName("Adrian", "Adesco") } );
- clients.Add(new ClientItem { Id = 2, Name = new ClientName("Brian", "Briar") } );
- clients.Add(new ClientItem { Id = 3, Name = new ClientName("Clive", "Cussler") } );
- }
- private void GenerateReport()
- {
- this.Text = "Report Control Demo";
- this.ClientSize = new System.Drawing.Size(950, 600);
- ReportViewer reportViewer = new ReportViewer();
- reportViewer.ProcessingMode = ProcessingMode.Local;
- reportViewer.LocalReport.ReportPath = "TestReport.rdlc";
- reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReportTest_ClientItem", clients));
- reportViewer.Dock = DockStyle.Fill;
- this.Controls.Add(reportViewer);
- reportViewer.RefreshReport();
- }
- }
- }
- public class ClientName
- {
- public ClientName(string first, string last)
- {
- FirstName = first;
- LastName = last;
- }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- }
- [assembly: AllowPartiallyTrustedCallers]
Add Comment
Please, Sign In to add comment