System.Web.HttpException: Cannot compute Count for a data source t

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 4, 2004.

  1. When i try to do paging in Datagrid why do i get the error:-
    System.Web.HttpException: Cannot compute Count for a data source that does
    not implement ICollection.?
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 4, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Scott Allen Guest

    Hi Patrick:

    The underlying DataSource has to support the ICollection interface in
    order for the grid to perform automatic paging. ICollection requires a
    class to implement a Count property. ArrayList and DataView both
    support the interface, so you could use them as DataSources.

    Other classes only support the IEnumerable interface. This allows them
    to be used as a DataSource but not as a paged data source.
    SqlDataReader would be an example of such a class.

    Making sense?

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/


    On Wed, 3 Nov 2004 22:49:02 -0800, "Patrick.O.Ige"
    <> wrote:
    >When i try to do paging in Datagrid why do i get the error:-
    >System.Web.HttpException: Cannot compute Count for a data source that does
    >not implement ICollection.?
    Scott Allen, Nov 4, 2004
    #2
    1. Advertising

  3. Re: System.Web.HttpException: Cannot compute Count for a data sour

    Yep Scott
    It makes sense!
    Just trying to get deep into Datalist,Datagrid and Repeater controls
    and there possibilities..
    More Questions coming soon:)


    "Scott Allen" wrote:

    > Hi Patrick:
    >
    > The underlying DataSource has to support the ICollection interface in
    > order for the grid to perform automatic paging. ICollection requires a
    > class to implement a Count property. ArrayList and DataView both
    > support the interface, so you could use them as DataSources.
    >
    > Other classes only support the IEnumerable interface. This allows them
    > to be used as a DataSource but not as a paged data source.
    > SqlDataReader would be an example of such a class.
    >
    > Making sense?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    >
    > On Wed, 3 Nov 2004 22:49:02 -0800, "Patrick.O.Ige"
    > <> wrote:
    > >When i try to do paging in Datagrid why do i get the error:-
    > >System.Web.HttpException: Cannot compute Count for a data source that does
    > >not implement ICollection.?

    >
    >
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 4, 2004
    #3
  4. Re: System.Web.HttpException: Cannot compute Count for a data sour

    HI Scott,
    So that means its only DataGrid that supports Automatic paging...
    With others u will have to use Custom Paging?


    "Patrick.O.Ige" wrote:

    > Yep Scott
    > It makes sense!
    > Just trying to get deep into Datalist,Datagrid and Repeater controls
    > and there possibilities..
    > More Questions coming soon:)
    >
    >
    > "Scott Allen" wrote:
    >
    > > Hi Patrick:
    > >
    > > The underlying DataSource has to support the ICollection interface in
    > > order for the grid to perform automatic paging. ICollection requires a
    > > class to implement a Count property. ArrayList and DataView both
    > > support the interface, so you could use them as DataSources.
    > >
    > > Other classes only support the IEnumerable interface. This allows them
    > > to be used as a DataSource but not as a paged data source.
    > > SqlDataReader would be an example of such a class.
    > >
    > > Making sense?
    > >
    > > --
    > > Scott
    > > http://www.OdeToCode.com/blogs/scott/
    > >
    > >
    > > On Wed, 3 Nov 2004 22:49:02 -0800, "Patrick.O.Ige"
    > > <> wrote:
    > > >When i try to do paging in Datagrid why do i get the error:-
    > > >System.Web.HttpException: Cannot compute Count for a data source that does
    > > >not implement ICollection.?

    > >
    > >
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 5, 2004
    #4
  5. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Scott Allen Guest

    Re: System.Web.HttpException: Cannot compute Count for a data sour

    Yes, that's right. If you want to page a result set with a Repeater or
    DataList you'll need to add that functionality with custom code.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Thu, 4 Nov 2004 17:00:02 -0800, "Patrick.O.Ige"
    <> wrote:

    >HI Scott,
    > So that means its only DataGrid that supports Automatic paging...
    >With others u will have to use Custom Paging?
    >
    >
    Scott Allen, Nov 5, 2004
    #5
    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. Steve
    Replies:
    0
    Views:
    5,331
    Steve
    Jul 1, 2003
  2. Frank
    Replies:
    1
    Views:
    1,576
  3. Steve Litvack

    DataGrid Issue: "Cannot compute Count" for AllowCustomPaging

    Steve Litvack, Aug 12, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    173
    Steve Litvack
    Aug 16, 2003
  4. nxliu
    Replies:
    1
    Views:
    1,095
    Ben Lovell
    Aug 25, 2004
  5. PerlFAQ Server
    Replies:
    0
    Views:
    266
    PerlFAQ Server
    Feb 2, 2011
Loading...

Share This Page