Datagrid paging problem

Discussion in 'ASP .Net' started by J. Muenchbourg, May 27, 2004.

  1. I'm trying to use paging in a datagrid, but I can't get past the "cannot
    compute Count for a data source that does not implement ICollection"
    application error, as it does not point to a line in the code. Does the
    same thing even when i change the AllowCustomPaging property to
    AllowPaging . Wondering how to enable ICollection for the datasource:

    ''''
    Sub myDataGrid_PageChanger(Source As Object, _
    E As DataGridPageChangedEventArgs)
    ' Set the CurrentPageIndex before binding the grid
    myDataGrid.CurrentPageIndex = E.NewPageIndex
    BindData
    End Sub
    ''''

    <form runat="server" method="post">
    <asp:Datagrid runat="server"
    Id="MyDataGrid"
    GridLines="Both"
    cellpadding="0"
    cellspacing="0"
    Headerstyle-BackColor="#9999ff"
    Headerstyle-Font-Name="Arial"
    Headerstyle-Font-Size="12"
    Headerstyle-Font-Bold="True"
    BackColor="#00ffff"
    Font-Name="Arial"
    Font-Size="11"
    BorderColor="Black"
    showfooter="true"
    footerstyle-BackColor="#9999ff"
    footerstyle-Font-Name="Arial"
    AlternatingItemStyle-BackColor="#ffffff"
    AutogenerateColumns="False"
    OnEditcommand="MyDataGrid_EditCommand"
    OnCancelcommand="MyDataGrid_Cancel"
    OnUpdateCommand="MyDataGrid_UpdateCommand"
    AllowCustomPaging="True"
    PageSize="10"
    PagerStyle-Mode="NextPrev"
    PagerStyle-NextPageText="Next ->"
    pagerstyle-prevpagetext="<- Previous"
    PagerStyle-Font-Bold="True"
    OnPageIndexChanged="myDataGrid_PageChanger">

    </asp:DataGrid>
    </form>
    '''''

    Thanks in advance
    Muench


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    J. Muenchbourg, May 27, 2004
    #1
    1. Advertising

  2. J. Muenchbourg

    Joe Fallon Guest

    What is your datasource???

    Does it implement the ICollection interface?

    If not, you have to re-code it so it does.
    --
    Joe Fallon



    "J. Muenchbourg" <> wrote in message
    news:...
    >
    > I'm trying to use paging in a datagrid, but I can't get past the "cannot
    > compute Count for a data source that does not implement ICollection"
    > application error, as it does not point to a line in the code. Does the
    > same thing even when i change the AllowCustomPaging property to
    > AllowPaging . Wondering how to enable ICollection for the datasource:
    >
    > ''''
    > Sub myDataGrid_PageChanger(Source As Object, _
    > E As DataGridPageChangedEventArgs)
    > ' Set the CurrentPageIndex before binding the grid
    > myDataGrid.CurrentPageIndex = E.NewPageIndex
    > BindData
    > End Sub
    > ''''
    >
    > <form runat="server" method="post">
    > <asp:Datagrid runat="server"
    > Id="MyDataGrid"
    > GridLines="Both"
    > cellpadding="0"
    > cellspacing="0"
    > Headerstyle-BackColor="#9999ff"
    > Headerstyle-Font-Name="Arial"
    > Headerstyle-Font-Size="12"
    > Headerstyle-Font-Bold="True"
    > BackColor="#00ffff"
    > Font-Name="Arial"
    > Font-Size="11"
    > BorderColor="Black"
    > showfooter="true"
    > footerstyle-BackColor="#9999ff"
    > footerstyle-Font-Name="Arial"
    > AlternatingItemStyle-BackColor="#ffffff"
    > AutogenerateColumns="False"
    > OnEditcommand="MyDataGrid_EditCommand"
    > OnCancelcommand="MyDataGrid_Cancel"
    > OnUpdateCommand="MyDataGrid_UpdateCommand"
    > AllowCustomPaging="True"
    > PageSize="10"
    > PagerStyle-Mode="NextPrev"
    > PagerStyle-NextPageText="Next ->"
    > pagerstyle-prevpagetext="<- Previous"
    > PagerStyle-Font-Bold="True"
    > OnPageIndexChanged="myDataGrid_PageChanger">
    >
    > </asp:DataGrid>
    > </form>
    > '''''
    >
    > Thanks in advance
    > Muench
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Joe Fallon, May 28, 2004
    #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. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,864
    Scott Allen
    Oct 8, 2004
  2. Roger
    Replies:
    0
    Views:
    981
    Roger
    Dec 28, 2004
  3. wh1974
    Replies:
    0
    Views:
    2,485
    wh1974
    Jan 12, 2005
  4. Red
    Replies:
    1
    Views:
    767
  5. Green Start Button

    DataGrid.Items.Count and DataGrid Paging...

    Green Start Button, Aug 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,872
    agravar
    Aug 2, 2006
Loading...

Share This Page