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

G

Guest

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

Scott Allen

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

Guest

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

Guest

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

Scott Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top