locked
Sr No RRS feed

  • Question

  • User-1499457942 posted

    Hi

      In expression i have written 

    =Code.writeRow() . In Code i have written below code


    Dim rownumber = 0
    Function writeRow()
    rownumber = rownumber + 1
    return rownumber
    End Function

    When i run report it shows correct Sr No . When i export to PDF it shows wrong number . Suppose on Screen it shows 1 to 5 but in pdf it shows 6 to 10

    Thanks

    Saturday, July 14, 2018 6:17 AM

All replies

  • User1992938117 posted

    Suppose on Screen it shows 1 to 5 but in pdf it shows 6 to 10

    That means "rownumber" variable persist and you are calling WriteRow() again while exporting to PDF.

    Have a close look on your code [May be you are calling this method on PageLoad() and while export it called PageLoad() again, If so then do If(!Page.IsPostBack) and call WriteRow() method - Just an assumption]

    Saturday, July 14, 2018 6:47 AM
  • User-1171043462 posted

    In the PDF export function first line set

     rownumber = 0

    So it will again start from 1.

    Saturday, July 14, 2018 11:33 AM