Paging on Datagrid Does Not Work

Discussion in 'ASP .Net Web Controls' started by Bruce LeMond, Sep 29, 2003.

  1. Bruce LeMond

    Bruce LeMond Guest

    This is a Visual Basic web form. I set the datagrid
    properties to allow for paging with 10 rows displayed per
    page. When I run and click on the Next button (>), it
    does not go to the next page. There are more than 10 rows
    to be displayed. Anyone knows why this is not working?

    Thanks in advance.
    Bruce LeMond, Sep 29, 2003
    #1
    1. Advertising

  2. Bruce LeMond

    vMike Guest

    Make sure you have AllowPaging=True

    "Bruce LeMond" <> wrote in message
    news:1849a01c386af$1d703ec0$...
    > This is a Visual Basic web form. I set the datagrid
    > properties to allow for paging with 10 rows displayed per
    > page. When I run and click on the Next button (>), it
    > does not go to the next page. There are more than 10 rows
    > to be displayed. Anyone knows why this is not working?
    >
    > Thanks in advance.
    vMike, Sep 29, 2003
    #2
    1. Advertising

  3. Bruce LeMond

    Bruce LeMond Guest

    I checked and the allowPaging is set to TRUE. But I
    discovered that I needed to add this coding:

    Private Sub DataGrid1_PageIndexChanged(ByVal source As
    Object, ByVal e As
    System.Web.UI.WebControls.DataGridPageChangedEventArgs)
    Handles DataGrid1.PageIndexChanged
    DataGrid1.CurrentPageIndex = e.NewPageIndex
    DataGrid1.DataBind()
    End Sub

    But when I added this code and ran, I received this
    following error message:

    System.Web.HttpException: Invalid CurrentPageIndex value.
    It must be >= 0 and < the PageCount.

    Could you think of anything else?

    Thanks,
    Bruce
    >-----Original Message-----
    >Make sure you have AllowPaging=True
    >
    >"Bruce LeMond" <> wrote in message
    >news:1849a01c386af$1d703ec0$...
    >> This is a Visual Basic web form. I set the datagrid
    >> properties to allow for paging with 10 rows displayed

    per
    >> page. When I run and click on the Next button (>), it
    >> does not go to the next page. There are more than 10

    rows
    >> to be displayed. Anyone knows why this is not working?
    >>
    >> Thanks in advance.

    >
    >
    >.
    >
    Bruce LeMond, Sep 29, 2003
    #3
  4. Bruce LeMond

    Slawek Guest

    Hi,
    I think that you should check when you fill dataset because exception that
    you receive means that there is no second page in dataset (there is less
    then 10 rows). When you open page for the first time - there is more then 10
    rows (becouse next button appear), but click on the "next" link to reloads
    page and probably after reload you don't fill dataset.
    Check if there is no code like this :
    if(! IsPostback)
    {
    //fill of your dataset
    }

    I think that this is your problem

    Regards
    Slawek


    "Bruce LeMond" <> wrote in message
    news:11c301c386d4$4140f270$...
    > I checked and the allowPaging is set to TRUE. But I
    > discovered that I needed to add this coding:
    >
    > Private Sub DataGrid1_PageIndexChanged(ByVal source As
    > Object, ByVal e As
    > System.Web.UI.WebControls.DataGridPageChangedEventArgs)
    > Handles DataGrid1.PageIndexChanged
    > DataGrid1.CurrentPageIndex = e.NewPageIndex
    > DataGrid1.DataBind()
    > End Sub
    >
    > But when I added this code and ran, I received this
    > following error message:
    >
    > System.Web.HttpException: Invalid CurrentPageIndex value.
    > It must be >= 0 and < the PageCount.
    >
    > Could you think of anything else?
    >
    > Thanks,
    > Bruce
    > >-----Original Message-----
    > >Make sure you have AllowPaging=True
    > >
    > >"Bruce LeMond" <> wrote in message
    > >news:1849a01c386af$1d703ec0$...
    > >> This is a Visual Basic web form. I set the datagrid
    > >> properties to allow for paging with 10 rows displayed

    > per
    > >> page. When I run and click on the Next button (>), it
    > >> does not go to the next page. There are more than 10

    > rows
    > >> to be displayed. Anyone knows why this is not working?
    > >>
    > >> Thanks in advance.

    > >
    > >
    > >.
    > >
    Slawek, Sep 30, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh1974
    Replies:
    0
    Views:
    2,419
    wh1974
    Jan 12, 2005
  2. Red
    Replies:
    1
    Views:
    706
  3. js
    Replies:
    5
    Views:
    1,831
    Teemu Keiski
    Jul 8, 2005
  4. pietaster
    Replies:
    1
    Views:
    139
    Bernard O'Flynn
    Oct 28, 2003
  5. Paging in DataGrid does not work 2..

    , Nov 7, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    119
Loading...

Share This Page