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

  • Thread starter Thread starter Guest
  • Start date Start date
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.?
 
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?
 
Yep Scott
It makes sense!
Just trying to get deep into Datalist,Datagrid and Repeater controls
and there possibilities..
More Questions coming soon:)
 
HI Scott,
So that means its only DataGrid that supports Automatic paging...
With others u will have to use Custom Paging?
 
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

Back
Top