PageNumber & TotalPages in Dynamics NAV Report Layout

Have you ever struggled how to get page number & total pages in body section ?

Here is the solution that  might help for you. We can implement this by introducing new two functions in RDLC. Then you need to call these functions in the body area.

See the screen-shot bellow to get an idea.

page number in body of the report in navision
Snap.01

Use bellow functions for PageNumber & TotalPages. You can call these functions in body section (Code.PageNumber() or Code.TotalPages()).

Public Function PageNumber() as String
Return Me.Report.Globals!PageNumber.ToString()
End Function

Public Function TotalPages() as String
Dim str as String
str = Me.Report.Globals!TotalPages.ToString()
Return str
End Function