Professional Web Applications Themes

Paging not working in a datagrid - ASP.NET Data Grid Control

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" ...

  1. #1

    Default Paging not working in a datagrid


    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 [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    J. Muenchbourg Guest

  2. #2

    Default RE: Paging not working in a datagrid

    The grid datasource has to be class implement ICollection such as arraylist, DataView
    If you are using cutomizing page, VirtualPagenumber has to set to the count of the data source


    David Guest

  3. #3

    Default RE: Paging not working in a datagrid


    >The grid datasource has to be class implement ICollection >such as
    arraylist, DataView.
    ?????????
    >If you are using cutomizing page,
    >VirtualPagenumber has to
    >set to the count of the data >>source.
    ????

    i appreciate your help dave, but can you or anyone be more specific?
    thanks
    muench

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    J. Muenchbourg Guest

  4. #4

    Default Re: Paging not working in a datagrid

    What is your datasource? If it is a collection, it should inherit from
    collectionbase or another collection type which implements IEnumerable, etc.

    "J. Muenchbourg" <anonymousdex.com> wrote in message
    news:Ofoa%23oAREHA.736TK2MSFTNGP10.phx.gbl...
    >
    > 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 [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Rick Spiewak Guest

  5. #5

    Default Re: Paging not working in a datagrid



    Like the last response, the code you see is what I'm working with.
    Without the paging attributes, this script works fine. I have no idea if
    youre talking about the namescpae references: <% Import
    Namespace="System.Data" %>
    <% Import Namespace="System.Data.SQLClient" %>,
    or where the Icollection would be .
    Thanks
    Muench

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!

    J. Muenchbourg Guest

Similar Threads

  1. DataGris Paging not working (event not firing)
    By Ryan Rueckl in forum ASP.NET Data Grid Control
    Replies: 8
    Last Post: June 24th, 07:13 PM
  2. Why is my Paging not working in my DataGrid?
    By Anonieko Ramos in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 31st, 04:58 PM
  3. DB Paging not working
    By M P in forum ASP Database
    Replies: 2
    Last Post: June 24th, 12:14 PM
  4. First Datagrid row with paging
    By CSousa in forum ASP.NET General
    Replies: 0
    Last Post: August 1st, 05:40 PM
  5. Dreamweaver MX Paging Not Working Correctly - HELP!
    By Julian Roberts in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 18th, 09:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139