473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

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

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

Nov 18 '05 #1
4 3587
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"
<Pa*********@discussions.microsoft.com> 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.?


Nov 18 '05 #2
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"
<Pa*********@discussions.microsoft.com> 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.?


Nov 18 '05 #3
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"
<Pa*********@discussions.microsoft.com> 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.?


Nov 18 '05 #4
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"
<Pa*********@discussions.microsoft.com> wrote:
HI Scott,
So that means its only DataGrid that supports Automatic paging...
With others u will have to use Custom Paging?


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DC Gringo | last post by:
I'm having such a problem with this DropDownList in a user control that is posting back and throwing an error: System.Web.HttpException: A DropDownList cannot have multiple items selected ...
4
by: emma middlebrook | last post by:
Hi Straight to the point - I don't understand why System.Array derives from IList (given the methods/properties actually on IList). When designing an interface you specify a contract. Deriving...
2
by: Michael Howes | last post by:
I have a single DataTable in a DataSet. It has 4 columns and i'd like to get a handful of counts of unique items in 3 of the 4 columns. Can a DataTables Select or Compute methods to COUNT DISTINCT?...
0
by: Amy | last post by:
Hi, I'm suddenly getting this error when I post back from my application. the application worked once, i added some code on one page (customizing a datagrid), and suddenly I'm getting this...
0
by: Frank | last post by:
Does anyone have any clues as to what might have caused this error? Only the startup web page uses ASP compatibility mode. I've tested this thru 100000s of cycles, and this recently appears in one...
1
by: dima | last post by:
Hi All, I know some of you had this problem in production. Did anyone find out how to fix this problem or what is the cause of it? System.Web.HttpException: Invalid_Viewstate ...
0
by: JT | last post by:
This seems like it could be an asp.net bug. I am getting the following exception when I add OnSortCommand attribute to a datagrid. I have deleted the temp directories, rebooted etc and I have...
1
by: Eugene Anthony | last post by:
BlogListing.aspx ---------------- <table width="786"> <asp:Repeater ID="rptComments" runat="server"> <ItemTemplate> <tr> <td bgcolor="#eaeaea"><%# Eval("SenderID") %></td> </tr> <tr>
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.