Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Paging not working in a datagrid

Reply
Thread Tools

Paging not working in a datagrid

 
 
J. Muenchbourg
Guest
Posts: n/a
 
      05-27-2004

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">
<aspatagrid 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">

</aspataGrid>
</form>
'''''

Thanks in advance
Muench



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
David
Guest
Posts: n/a
 
      05-27-2004
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


 
Reply With Quote
 
 
 
 
J. Muenchbourg
Guest
Posts: n/a
 
      05-27-2004


>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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Rick Spiewak
Guest
Posts: n/a
 
      05-28-2004
What is your datasource? If it is a collection, it should inherit from
collectionbase or another collection type which implements IEnumerable, etc.

"J. Muenchbourg" <(E-Mail Removed)> wrote in message
news:Ofoa%(E-Mail Removed)...
>
> 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">
> <aspatagrid 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">
>
> </aspataGrid>
> </form>
> '''''
>
> Thanks in advance
> Muench
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
J. Muenchbourg
Guest
Posts: n/a
 
      05-28-2004


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" %>
<%@ Import Namespace="System.Data.SQLClient" %>,
or where the Icollection would be .
Thanks
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
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
PAGING not working in ASP DataGrid getziiiiiiiiiii ASP .Net 2 03-13-2007 01:20 AM
ASP .Net Dynamic Datagrid- Paging not working as desired ashish.dwivedi1@gmail.com ASP .Net 0 10-09-2006 12:49 PM
Combining numeric mode paging and nextPreview paging in datagrid Red ASP .Net 1 03-12-2005 11:41 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
Datagrid Paging not working Coleen ASP .Net 4 12-31-2003 10:28 PM



Advertisments