How to display the correct page number in the body of SSR (In each page of the output)

advertisements

i Placed this code in my report property code

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

and called in my text box in body of report Like this

 =Code.PageNumber()

It was not able to repeat textbox on each page. It is showing the page number as 1 only on first page.

need to show pagenumber in each page of the output in body of the report

Kindly help me on this if u have any solution.


First Follow the steps 1 below to do pagination:
1)
1.1. Click the Details group in the Row Groups pane.
1.2. From the Tablix member Properties pane, expand “Group”-> “PageBreak”.
1.3. Set the “BreakLocation” to “End” and set the “Disable” property to the expression like below:
=IIF(rownumber(nothing) mod 40=0,false,true)
The above point 1 is use to do pagination in Report output(Display only 40 records per page in output)

2) use custom code:

Public Function PageNumberno(val as integer) as String
     Dim str as String
     str =(val/40)
     Return str
End Function

3) Create Calculated column in Dataset and enter =0 in expression

4) In 2 Calculated Column
1)Pageno
2)No in Dataset

In Report Body use Expression for PageNo :

  =code.PageNumberno(Rownumber("DataSet1"))

use Expression for No :

 =IIF(Instr(code.PageNumberno(Rownumber("DataSet1"))
,".")<>0,
(Left(code.PageNumberno(Rownumber("DataSet1")),
(Instr(code.PageNumberno(Rownumber("DataSet1")),".")-1))+1)
,code.PageNumberno(Rownumber("DataSet1"))
)

5)Right click and insert column on Right Side and in Column name add code in Text box

=ReportItems!No.Value

Note: No is calculated Field column name.

6)Under AdvancedMode IN Row Group select Static and Set RepeatOnNewPage Properties to True

In the Above Column created under point 5 will display correct page no in every page in body of the report

I have Tried and its working Fine..Try it.