gridview paging is not working

class file shown below:

Imports Microsoft.VisualBasic


Public Class TTReportsChangeofAddressExceptionGridView
    Inherits TTReportsGridViewFiller
    Implements IReportResult

    'Private _userId As Integer
    Private _userType As String
    Private _plpId As Integer

    Public Sub New(ByVal sDealers As String, ByVal sFinalizeDateFrom As String, ByVal sFinalizeDateTo As String, ByVal sExceptionSource As String)

        MyBase.New()

        _Dealers = WebFormHelper.ToSqlString(sDealers)

        Try : DateTime.TryParse(sFinalizeDateFrom, _FinalizedDateFrom)
        Catch ex As Exception : _FinalizedDateFrom = SqlTypes.SqlDateTime.Null : End Try

        Try : DateTime.TryParse(sFinalizeDateTo, _FinalizedDateTo)
        Catch ex As Exception : _FinalizedDateTo = SqlTypes.SqlDateTime.Null : End Try

        _ExceptionSource = WebFormHelper.ToSqlString(IIf(String.IsNullOrEmpty(sExceptionSource), "both", sExceptionSource.ToLower()))

        _UserID = UserSession.UserID
        _userType = Security.GetRuleValue("user_type")
        _plpId = UserSession.PrivateLabelPartnerID

    End Sub

    Public Overrides Sub DataBind(ByRef gv As GridView, ByVal iSortField As Integer, ByVal iSortDirection As Integer, ByRef dtOutput As DataTable, Optional ByVal bBindGrid As Boolean = True)

        Dim sStoredProc = "spTTReports_AddressException"

        Dim arrSqlParameters As SqlParameter() = { _
            New SqlParameter("@dealers", _Dealers), _
            New SqlParameter("@finaldatefrom", _FinalizedDateFrom), _
            New SqlParameter("@finaldateto", _FinalizedDateTo), _
            New SqlParameter("@exceptionSource", _ExceptionSource), _
            New SqlParameter("@plpId", _plpId), _
            New SqlParameter("@userId", _UserID), _
            New SqlParameter("@userType", _userType) _
            }

        Dim arrDSColumnNames() As String = {"t21 ID", "Deal #", "Dealer Name", "Customer Name", _
                                             "Old Address", "New Address", _
                                            "Deal Date", "Days Since Deal", _
                                            "Finalized Date", "Days Since Finalized", _
                                            "Source", "Transmitted Date"}

        MyBase.DataBind(gv, iSortField, iSortDirection, sStoredProc, arrSqlParameters, arrDSColumnNames)
        dtOutput = _dt

        If bBindGrid Then
            AddHandler gv.RowDataBound, AddressOf gv_RowDataBound

            MyBase.FillGridView(gv)
        End If

    End Sub

    Private Sub gv_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)

        If e.Row.RowType = DataControlRowType.Header Then
            For i As Integer = 0 To e.Row.Cells.Count - 1
                Dim txt As String = CType(e.Row.Cells(i).Controls(0), LinkButton).Text
                Dim href As New HtmlAnchor
                href.InnerText = txt
                href.HRef = "javascript:sortGrid(" + (i + 1).ToString() + ");"

                e.Row.Cells(i).Controls.Clear()
                e.Row.Cells(i).Controls.Add(href)
            Next
        End If

        ' cause a string like "blah;blah;blah" to appear in a column
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Cells(3).Text = e.Row.Cells(3).Text.Replace(";", ";<br>")
        End If

    End Sub

    Public Sub PrepareGrid(ByVal gv As System.Web.UI.WebControls.GridView) Implements IReportResult.PrepareGrid
        gv.AllowPaging = True
        gv.AllowSorting = True
    End Sub

    Public Sub PrepareGridViewColumns(ByRef gv As System.Web.UI.WebControls.GridView, ByVal SelectedDate As String) Implements IReportResult.PrepareGridViewColumns
        Dim col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12 As New BoundField
        col1.HeaderText = "t21 ID"
        col1.DataField = "t21 ID"
        col1.SortExpression = "1"

        col2.HeaderText = "Deal #"
        col2.DataField = "Deal #"
        col2.SortExpression = "2"

        col3.HeaderText = "Dealer Name"
        col3.DataField = "Dealer Name"
        col3.SortExpression = "3"

        col4.HeaderText = "Customer Name"
        col4.DataField = "Customer Name"
        col4.SortExpression = "4"

        col5.HeaderText = "Old Address"
        col5.DataField = "Old Address"
        col5.SortExpression = "5"

        col6.HeaderText = "New Address"
        col6.DataField = "New Address"
        col6.SortExpression = "6"

        col7.HeaderText = "Deal Date"
        col7.DataField = "Deal Date"
        col7.SortExpression = "7"

        col8.HeaderText = "Days Since Deal"
        col8.DataField = "Days Since Deal"
        col8.SortExpression = "8"
        col8.ItemStyle.HorizontalAlign = HorizontalAlign.Center

        col9.HeaderText = "Finalized Date"
        col9.DataField = "Finalized Date"
        col9.SortExpression = "9"

        col10.HeaderText = "Days Since Final"
        col10.DataField = "Days Since Finalized"
        col10.SortExpression = "10"
        col10.ItemStyle.HorizontalAlign = HorizontalAlign.Center

        col11.HeaderText = "Source"
        col11.DataField = "Source"
        col11.SortExpression = "11"

        col12.HeaderText = "Transmitted Date"
        col12.DataField = "Transmitted Date"
        col12.SortExpression = "12"

        gv.Columns.Add(col1)
        gv.Columns.Add(col2)
        gv.Columns.Add(col3)
        gv.Columns.Add(col4)
        gv.Columns.Add(col5)
        gv.Columns.Add(col6)
        gv.Columns.Add(col7)
        gv.Columns.Add(col8)
        gv.Columns.Add(col9)
        gv.Columns.Add(col10)
        gv.Columns.Add(col11)
        gv.Columns.Add(col12)
    End Sub

    Public Function PrepareModifiedColumnName(ByVal ColumnName As String) As String Implements IReportResult.PrepareModifiedColumnName
        Return ColumnName
    End Function

    Public Sub PrepareReportHTML(ByVal tbl As System.Web.UI.WebControls.Table, ByVal dt As System.Data.DataTable) Implements IReportResult.PrepareReportHTML
        Dim bDisplayColumnTotals As Boolean = False

        Dim tr As New TableRow
        Dim td(dt.Columns.Count - 1) As TableCell
        Dim arrTotal(dt.Columns.Count - 1) As Double
        Dim bSubTotal As Boolean = True

        For i As Integer = LBound(td) To UBound(td)
            td(i) = New TableCell()
            td(i).Text = PrepareModifiedColumnName(dt.Columns(i).ColumnName)
            td(i).Font.Names = New String() {"Arial"}
            td(i).Font.Size = FontUnit.Point(8)
            td(i).Font.Bold = True
            td(i).Wrap = True

            td(i).Style("border-bottom") = "2px solid black"
            tr.Cells.Add(td(i))

            ' Reset Column Totals
            If bDisplayColumnTotals Then arrTotal(i) = 0
        Next
        tbl.Rows.Add(tr)

        For r As Integer = 0 To dt.Rows.Count - 1
            tr = New TableRow
            For i As Integer = LBound(td) To UBound(td)
                td(i) = New TableCell()
                td(i).Font.Names = New String() {"Arial"}
                td(i).Font.Size = FontUnit.Point(8)
                If IsDBNull(dt.Rows(r)(i)) Then
                    td(i).Text = ""
                Else
                    td(i).Text = dt.Rows(r)(i)
                End If

                If r Mod 2 = 0 Then
                    td(i).BackColor = Drawing.Color.FromArgb(255, 255, 255)
                Else
                    td(i).BackColor = Drawing.Color.FromArgb(225, 225, 225)
                End If

                '' Check if this is a SubTotal Row
                'bSubTotal = False
                'If bSubTotal Then
                '    td(i).BackColor = Drawing.Color.FromArgb(201, 202, 203)
                'End If

                '' Add to Total
                'If bDisplayColumnTotals Then
                '    If IsNumeric(dt.Rows(r)(i)) Then
                '        arrTotal(i) = arrTotal(i) + dt.Rows(r)(i)
                '    End If
                'End If

                If (i = 6 OrElse i = 8) Then
                    td(i).HorizontalAlign = HorizontalAlign.Center
                End If

                tr.Cells.Add(td(i))
            Next
            tbl.Rows.Add(tr)
        Next

        ' Optionally display Footer
        If bDisplayColumnTotals Then
            tr = New TableRow

            For i As Integer = LBound(td) To UBound(td)
                td(i) = New TableCell()

                td(i).Text = arrTotal(i)

                td(i).Font.Names = New String() {"Arial"}
                td(i).Font.Size = FontUnit.Point(8)
                td(i).Font.Bold = True
                td(i).Wrap = True
                td(i).Style("border-top") = "2px solid black"
                tr.Cells.Add(td(i))
            Next
            tbl.Rows.Add(tr)
        End If

    End Sub

    Public Sub PrepareReportSpecificGridView(ByVal divCanvas As System.Web.UI.HtmlControls.HtmlGenericControl, ByVal lbl As System.Web.UI.WebControls.Label, ByVal ddlPageSize As System.Web.UI.WebControls.DropDownList) Implements IReportResult.PrepareReportSpecificGridView
        divCanvas.Style.Add("width", "1550px")
    End Sub

    Public Sub PrepareReportSpecificVariables(ByRef dt As System.Data.DataTable, _
                                              ByRef xslFile As String, _
                                              ByRef ReportTitle As String, _
                                              ByVal bTotalColumns As Boolean) Implements IReportResult.PrepareReportSpecificVariables
        'xslFile = "ScanningExceptions.xsl"
        ReportTitle = "Change of Address Exceptions"
    End Sub

End Class

Open in new window

MeinhoonaaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jerry MillerCommented:
Any error messages or is it doing nothing?
MeinhoonaaAuthor Commented:
No error messages, it is doing nothing.
Monica PSoftware DeveloperCommented:
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Jerry MillerCommented:
Do you have a pageIndexChanging Event? If so does your code ever hit it? I have found that when you dynamically create gridviews you need to manually handle the paging and sorting events as well.

See Akila P's link for a couple of examples.
MeinhoonaaAuthor Commented:
can u send me the links?
Monica PSoftware DeveloperCommented:
For Example :

In aspx :

<asp:GridView ID="GridVwPagingSorting" runat="server" AutoGenerateColumns="False"
                Font-Names="Verdana" AllowPaging="True" AllowSorting="True" PageSize="5" Width="75%"
               OnPageIndexChanging="PageIndexChanging" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" OnSorting="Sorting">

In Code :

protected void PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridVwPagingSorting.PageIndex = e.NewPageIndex;
            DataView dvEmployee = Getdata();
            GridVwPagingSorting.DataSource = dvEmployee;
            GridVwPagingSorting.DataBind();
        }

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MeinhoonaaAuthor Commented:
tks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.