Wierd DataGrid behaviour

Discussion in 'ASP .Net' started by Simon, Nov 5, 2003.

  1. Simon

    Simon Guest

    Guys,

    I have a datagrid that has paging, with the below code.

    It _used_ to work, but now doesn't. No idea why.
    However, if I put code breaks on the lines indicated with
    *, I get the following results:

    ..DataBind: PageCount = 16, CurrentPageIndex = 2
    ..Write: PageCount = 1, CurrentPageIndex = 2

    So, calling databind results in 15 pages disappearing, and
    then this error:

    "Invalid CurrentPageIndex value. It must be >= 0 and < the
    PageCount."

    Any ideas?

    Simon.



    private void DataGrid1_PageIndexChanged(object source,
    System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    {
    System.Data.DataView dvData =
    (System.Data.DataView)Session["myData"];
    DataGrid1.DataSource = dvData ;
    DataGrid1.CurrentPageIndex = e.NewPageIndex;
    try
    {
    * DataGrid1.DataBind();
    }
    catch
    {
    * Response.Write("error");
    }
    }
     
    Simon, Nov 5, 2003
    #1
    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. PSN
    Replies:
    3
    Views:
    375
  2. Vaddina Prakash Rao

    Wierd behaviour of function 'strcspn'

    Vaddina Prakash Rao, Dec 17, 2004, in forum: C Programming
    Replies:
    2
    Views:
    347
    Dave Thompson
    Dec 20, 2004
  3. SiWi
    Replies:
    3
    Views:
    859
    geremy condra
    Dec 9, 2009
  4. Brian Lowe

    Datagrid paging wierd behaviour

    Brian Lowe, Oct 23, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    722
    Brian Lowe
    Oct 26, 2006
  5. Damphyr
    Replies:
    0
    Views:
    169
    Damphyr
    Jan 29, 2004
Loading...

Share This Page