I'm trying to modify an existing rdlc file in a C# Windows Forms project The report works, but it only shows the first item in the List. How do I get it to show 1 page for each item in the List?
My report's dataset is a list with these values:
When I view the report in the report viewer, I only see the 1st item in the list on one page instead of two pages with 1 item on each page.
Here is the code for my class:
public class WorkOrderItemViewModel
{
public string FilterSize { get; set; }
public int OrderID { get; set; }
}
Here's where I call the report in the report viewer:
private Microsoft.Reporting.WinForms.ReportViewer OrderSummaryReportViewer;
this.OrderSummaryReportViewer = new Microsoft.Reporting.WinForms.ReportViewer();
OrderSummaryReportViewer.LocalReport.DataSources.Clear();
OrderSummaryReportViewer.LocalReport.DataSources.Add(new ReportDataSource("WorkOrderItemsDataSet", workOrderDetailViewModel.WorkOrderItems));
this.OrderSummaryReportViewer.Dock = System.Windows.Forms.DockStyle.Fill;
reportDataSource1.Name = "WorkOrderItemsDataSet";
reportDataSource1.Value = null;
reportDataSource2.Name = "WorkOrderDetailDataSet";
reportDataSource2.Value = null;
this.OrderSummaryReportViewer.LocalReport.DataSources.Add(reportDataSource1);
this.OrderSummaryReportViewer.LocalReport.DataSources.Add(reportDataSource2);
this.OrderSummaryReportViewer.LocalReport.DisplayName = "Pick List";
this.OrderSummaryReportViewer.LocalReport.ReportEmbeddedResource = "NTSupply.CustomFilter.Reports.OrderSummaryReport.rdlc";
this.OrderSummaryReportViewer.Location = new System.Drawing.Point(0, 0);
this.OrderSummaryReportViewer.Name = "OrderSummaryReportViewer";
this.OrderSummaryReportViewer.Size = new System.Drawing.Size(960, 621);
this.OrderSummaryReportViewer.TabIndex = 0;
this.OrderSummaryReportViewer.RenderingComplete += new Microsoft.Reporting.WinForms.RenderingCompleteEventHandler(this.OrderSummaryReportViewer_RenderingComplete);
OrderSummaryReportViewer.RefreshReport();
Here's the rdlc in the designer:
Here's the code for the rdlc:
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Textbox Name="Textbox21">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Finished Good:</Value>
<Style>
<FontSize>12pt</FontSize>
<FontWeight>Bold</FontWeight>
<TextDecoration>None</TextDecoration>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox11</rd:DefaultName>
<Top>0.17187in</Top>
<Left>0.05in</Left>
<Height>0.25in</Height>
<Width>1.33333in</Width>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Bottom</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="FilterSize1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!FilterSize.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>FilterSize1</rd:DefaultName>
<Top>0.17187in</Top>
<Left>1.45278in</Left>
<Height>0.25in</Height>
<Width>1.55208in</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<VerticalAlign>Bottom</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Height>0.625in</Height>
<Style />
</Body>
<Width>8in</Width>
<Page>
<PageHeader>
<Height>0.5625in</Height>
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<ReportItems>
<Textbox Name="OrderID">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!OrderID.Value</Value>
<Style>
<FontSize>12pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>OrderID</rd:DefaultName>
<Top>0.125in</Top>
<Left>0.09861in</Left>
<Height>0.25in</Height>
<Width>2.90625in</Width>
<Style>
<Border>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</PageHeader>
<LeftMargin>0.25in</LeftMargin>
<RightMargin>0.25in</RightMargin>
<TopMargin>0.25in</TopMargin>
<BottomMargin>0.25in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="NTSupplyCustomFilterViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>af4b9e33-ffdc-42b0-82b7-cd63dceba934</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="WorkOrderItemsDataSet">
<Query>
<DataSourceName>NTSupplyCustomFilterViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Field Name="FilterSize">
<DataField>FilterSize</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="OrderID">
<DataField>OrderID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>NTSupply.CustomFilter.ViewModels</rd:DataSetName>
<rd:TableName>WorkOrderItemViewModel</rd:TableName>
<rd:ObjectDataSourceType>NTSupply.CustomFilter.ViewModels.WorkOrderItemViewModel, CustomFilterApplication, Version=1.0.1.57, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>a8be0d7c-0875-4915-91df-572c8fded42f</rd:ReportID>
</Report>
Edit:
Suggestion was for adding a table. This works in as far as adding a table and the page break displays the table data on multiple pages, but it's not quite what I need. Unfortunately, the request isn't for a table of data, but a formatted document with different labels. For instance, adding a table puts the second row of table data on the next page, but the label and values outside the table are only on the first page. I need those elements on a new page: