datagrid10.aspx sample.

Discussion in 'ASP .Net Datagrid Control' started by LL, Oct 30, 2003.

  1. LL

    LL Guest

    Hi,

    I'm testing the QuickStart's datagrid10.aspx. I add paging property to
    the grid.

    private void MyDataGrid_PageIndexChanged(object source,
    System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    { MyDataGrid.CurrentPageIndex = e.NewPageIndex;
    BindGrid();
    }

    I found that when delte the lastrecord on other page, got this error:


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

    Source Error:


    Line 92:
    Line 93: MyDataGrid.DataSource=ds.Tables["Employee"].DefaultView;
    Line 94: MyDataGrid.DataBind();
    Line 95: }
    Line 96:


    Source File: c:\project\QS\datagrid10.aspx.cs Line: 94

    How to fix it?

    Thansk..
    LL, Oct 30, 2003
    #1
    1. Advertising

  2. LL

    Alvin Bruney Guest

    There is no real fix for this. Unless I hear differently, I'm saying this is
    a known bug. Just catch the exception and reset the currentpageindex = 0.
    That works most of the times.

    --
    Regards,
    Alvin Bruney
    Got Tidbits? Get it here
    www.networkip.net/tidbits
    "LL" <> wrote in message
    news:%...
    > Hi,
    >
    > I'm testing the QuickStart's datagrid10.aspx. I add paging property to
    > the grid.
    >
    > private void MyDataGrid_PageIndexChanged(object source,
    > System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    > { MyDataGrid.CurrentPageIndex = e.NewPageIndex;
    > BindGrid();
    > }
    >
    > I found that when delte the lastrecord on other page, got this error:
    >
    >
    > Exception Details: System.Web.HttpException: Invalid CurrentPageIndex

    value.
    > It must be >= 0 and < the PageCount.
    >
    > Source Error:
    >
    >
    > Line 92:
    > Line 93: MyDataGrid.DataSource=ds.Tables["Employee"].DefaultView;
    > Line 94: MyDataGrid.DataBind();
    > Line 95: }
    > Line 96:
    >
    >
    > Source File: c:\project\QS\datagrid10.aspx.cs Line: 94
    >
    > How to fix it?
    >
    > Thansk..
    >
    >
    >
    >
    >
    Alvin Bruney, Nov 27, 2003
    #2
    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. Jake
    Replies:
    0
    Views:
    534
  2. Tim Chase
    Replies:
    0
    Views:
    64
    Tim Chase
    Feb 16, 2014
  3. Terry Reedy
    Replies:
    0
    Views:
    70
    Terry Reedy
    Feb 16, 2014
  4. Tim Chase
    Replies:
    0
    Views:
    79
    Tim Chase
    Feb 16, 2014
  5. Ned Batchelder
    Replies:
    0
    Views:
    71
    Ned Batchelder
    Feb 16, 2014
Loading...

Share This Page