Paging not working in a datagrid

J

J. Muenchbourg

I'm trying to use paging in a datagrid, but I can't get past the "cannot
compute Count for a data source that does not implement ICollection"
application error, as it does not point to a line in the code. Does the
same thing even when i change the AllowCustomPaging property to
AllowPaging . Wondering how to enable ICollection for the datasource:

''''
Sub myDataGrid_PageChanger(Source As Object, _
E As DataGridPageChangedEventArgs)
' Set the CurrentPageIndex before binding the grid
myDataGrid.CurrentPageIndex = E.NewPageIndex
BindData
End Sub
''''

<form runat="server" method="post">
<asp:Datagrid runat="server"
Id="MyDataGrid"
GridLines="Both"
cellpadding="0"
cellspacing="0"
Headerstyle-BackColor="#9999ff"
Headerstyle-Font-Name="Arial"
Headerstyle-Font-Size="12"
Headerstyle-Font-Bold="True"
BackColor="#00ffff"
Font-Name="Arial"
Font-Size="11"
BorderColor="Black"
showfooter="true"
footerstyle-BackColor="#9999ff"
footerstyle-Font-Name="Arial"
AlternatingItemStyle-BackColor="#ffffff"
AutogenerateColumns="False"
OnEditcommand="MyDataGrid_EditCommand"
OnCancelcommand="MyDataGrid_Cancel"
OnUpdateCommand="MyDataGrid_UpdateCommand"
AllowCustomPaging="True"
PageSize="10"
PagerStyle-Mode="NextPrev"
PagerStyle-NextPageText="Next ->"
pagerstyle-prevpagetext="<- Previous"
PagerStyle-Font-Bold="True"
OnPageIndexChanged="myDataGrid_PageChanger">

</asp:DataGrid>
</form>
'''''

Thanks in advance
Muench
 
D

David

The grid datasource has to be class implement ICollection such as arraylist, DataView
If you are using cutomizing page, VirtualPagenumber has to set to the count of the data source
 
J

J. Muenchbourg

The grid datasource has to be class implement ICollection >such as
arraylist, DataView.
?????????
If you are using cutomizing page,
VirtualPagenumber has to
set to the count of the data >>source.
????

i appreciate your help dave, but can you or anyone be more specific?
thanks
muench
 
R

Rick Spiewak

What is your datasource? If it is a collection, it should inherit from
collectionbase or another collection type which implements IEnumerable, etc.
 
J

J. Muenchbourg

Like the last response, the code you see is what I'm working with.
Without the paging attributes, this script works fine. I have no idea if
youre talking about the namescpae references: <%@ Import
Namespace="System.Data" %>
or where the Icollection would be .
Thanks
Muench
 

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

Similar Threads

Datagrid paging problem 1
paging 0
wrapping text in datagrid 1
Not working for allow paging in datagrid 1
DataGrid Paging 0
DataGrid issue-Urgent 0
Problem with Top And Bottom Paging 3
Hiding item in DataGrid 1

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top