Search code examples
c#rdlc

Reset Page Number in RDLC Report by group


This seems like it should be simple enough. I have a report that has Tablix in it that has groups by Customer forces a page break between groups. I want the page numbers to be per customer, so the pages would be like so:

Customer1 Page 1/2
Customer1 Page 2/2
Customer2 Page 1/1
Customer3 Page 1/4
etc, etc

I can't seem to find a way to reset the page numbers or cause the total pages to be total pages for the group.


Solution

  • It looks like this can't be done, at least in VS 2012. I was able to get it working in an RDL for SSRS, then I opened that RDL and found the relevant section

    <Group Name="MemberId">
      <GroupExpressions>
        <GroupExpression>=Fields!MemberId.Value</GroupExpression>
      </GroupExpressions>
      <PageBreak>
        <BreakLocation>StartAndEnd</BreakLocation>
        <ResetPageNumber>true</ResetPageNumber>
      </PageBreak>
    </Group>
    

    I then brought that back to my RDLC and inserted the <ResetPageNumber>true</ResetPageNumber> into my group. When I opened the file again in VS showed the following error.

    Deserialization failed: The element 'PageBreak' in namespace
    'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' 
    has invalid child element 'ResetPageNumber' in namespace 
    'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'. 
    List of possible elements expected: 'BreakLocation' in namespace 
    'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' 
    as well as any element in namespace '##other'. Line 1812, position 20.
    

    End result, I'm moving the report to Reporting Services.