Incrementing Serial Number in PDF Creation - ASP.NET

I am generating a PDF using ITextSharp in ASP.NET. I need to display a table, with some data and Serial No auto incremented. I tried the following (using loop - increment) but it doesn't seem to work.

Dim dsGetStudentFeeDetails = dbl.usp_GetFeeReceiptDetailsForStudent(sid).AsQueryable

        For Each f1 In dsGetStudentFeeDetails
            Dim i As Integer = 1
            stuName = New PdfPCell(FormatPhrase(i))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            stuName = New PdfPCell(FormatPhrase(f1.FeeAmountPaidDate))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            i = i + 1
        Next

When I run through this during execution, I noticed that the i = i + 1 doesn't get incremented. Why so?

Answers


you have to declare and set default value Above for loop use below code

Dim dsGetStudentFeeDetails = dbl.usp_GetFeeReceiptDetailsForStudent(sid).AsQueryable
          Dim i As Integer = 1
        For Each f1 In dsGetStudentFeeDetails

            stuName = New PdfPCell(FormatPhrase(i))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            stuName = New PdfPCell(FormatPhrase(f1.FeeAmountPaidDate))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            i = i + 1
        Next

Need Your Help

How to remove _source from search results in Tire gem for elasticsearch

ruby-on-rails elasticsearch tire

I'm indexing attachments in Elasticsearch (via Tire gem) and they're quite large. For whatever reason, and I wasn't expecting this, the search is dog slow. It appears to be because Tire (ES) is inc...

Multiple checkbox value in javascript

php javascript jquery ajax

I have this form which i submit using ajax and jquery or however it's said..

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.