Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > System.Web.HttpException: Cannot compute Count for a data source t

Reply
Thread Tools

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

 
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      11-04-2004
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.?

 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      11-04-2004
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"
<(E-Mail Removed)> 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.?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      11-04-2004
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"
> <(E-Mail Removed)> 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.?

>
>

 
Reply With Quote
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      11-05-2004
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"
> > <(E-Mail Removed)> 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.?

> >
> >

 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      11-05-2004
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"
<(E-Mail Removed)> wrote:

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 4.43 How do I compute the difference of two arrays? How do I compute the intersection of two arrays? PerlFAQ Server Perl Misc 0 02-02-2011 05:00 AM
i need a source code compute logical expressions in lex/yacc deltaa5 C++ 1 01-02-2007 11:34 PM
i need a source code compute logical expressions in lex/yacc deltaa5 C++ 2 01-02-2007 11:23 AM
Cannot compute Count for a data source that does not implement ICollection. nxliu ASP .Net Web Controls 1 08-25-2004 09:13 PM
DataGrid Issue: "Cannot compute Count" for AllowCustomPaging Steve Litvack ASP .Net Datagrid Control 3 08-16-2003 10:09 PM



Advertisments