Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3949788
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:32:05+00:00 2026-05-20T01:32:05+00:00

Problem: When I attempt to go to page 2 or any other subsequent page

  • 0

Problem:

When I attempt to go to page 2 or any other subsequent page of the data grid, it does nothing but refresh the page.

Markup:

<!--Main DataGrid-->
<asp:DataGrid
        ID="dgTasks"
        runat="server"
        PageSize="40"
        AllowPaging="true"
        AutoGenerateColumns="false"
        ForeColor="#333333"
        GridLines="Both"
        Font-Size="Small"
        AllowSorting="true"
        OnItemDataBound="Item_DataBound" >
        <HeaderStyle
            BackColor="#990000"
            Font-Bold="True"
            ForeColor="White"
            HorizontalAlign="Center"
            Font-Size="Small"/> 
        <Columns>
            ...
        </Columns>
        <SelectedItemStyle
            BackColor="#FFCC66"
            Font-Bold="True"
            ForeColor="Navy" />
        <PagerStyle
            BackColor="#CCCCCC"
            ForeColor="#333333"
            HorizontalAlign="Right"
            Mode="NumericPages" /> 
        <AlternatingItemStyle
            BackColor="White" /> 
        <ItemStyle
            BackColor="#FFFBD6"
            ForeColor="#333333" /> 
        <FooterStyle
            BackColor="#990000"
            Font-Bold="True"
            ForeColor="White" />
</asp:DataGrid>

Code Behind:

Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If IsPostBack Then
        'DoNothing'
    Else
        BindData("")
    End If
End Sub

Private Sub BindData(ByVal strDisplayCompleted As String, ByVal strSort As String)
    Dim taskDataSet As TaskDataSet = New TaskDataSet()
    Dim dt As DataTable = taskDataSet.GetData("N").Tables(0)
    For Each dr As DataRow In dt.Rows
        If dr.Item(2).ToString().StartsWith("Vacancy") Then
            dr.Delete()
        End If
    Next

    If strSort.Length > 0 Then
        dt.DefaultView.Sort = strSort
    End If
    dgTasks.DataSource = dt.DefaultView
    dgTasks.DataBind()
End Sub

Private Sub BindData(ByVal strSort As String)
    BindData("N", strSort)
End Sub

Now, I’m not even close to sure why the pagination is not working. I have AllowPaging equal to true, I’m not re-binding the data on PostBack, so I’m confused. Any help would be great. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:32:06+00:00Added an answer on May 20, 2026 at 1:32 am

    It doesn’t appear you are binding the datagrid to a control like ObjectDataSource, EntityDataSource which would automatically take care of the paging for you.

    You would need to handle Paging event from the gridview and then reset the page index yourself

    i.e.

    gridview.PageIndex = e.newPageIndex

    (I am not at machine with IDE so cant confirm this is syntactically correct right now)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempt to debug a program I wrote, but I'm running into a problem
Occasionally I have a problem when I attempt to update a web reference in
Problem: I have two spreadsheets that each serve different purposes but contain one particular
I am requesting aspx page which is using reportviewer control and returning html. Problem
I am building a splash page for a website with jquery animations. My problem
I have a unusual problem throwing an exception An attempt was made to load
I have a problem with locking the page with session AND I have to
I posted a couple of questions but haven't gotten any reply yet. Everything I
So i have a NivoSlider on my page. My problem is that i want
Issue is SOLVED: Problem is that it is a pre-compiled web page project and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.