Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2008, 01:52 AM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default Does DataTable support pager?

I used a DataTable as the DataSource for GridView, and enabled pager, but it didn't seem to page on its own. I made it work by handling RowCommand and PageIndexChanged event myself, and set PageIndex programatically.

After I read the document for GridView, I now suspect that DataTable does not support pager, which subsequently makes the GridView not paging (on its own). But I could not find any particular documentation on DataTable's pager capability.

Can anyone confirm this? or maybe point me to some web page. (google didn't seem too helpful in this case...)

Thanks in advance,
Peter
 
Old December 5th, 2008, 10:43 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

According to MSDN, automatic paging via the GridView is only supported for data sources, or for objects that implement the ICollection interface or one of its descendants (i.e. Enumerable, Dictionary, List, Queue, Stack, etc.)

A DataTable doesn't qualify on either of those counts, so your suspecion that the DataTable does not support automatic paging is correct. However, as you have learned, you can page through a DataTable programmatically. Another approach is to use the DataTable to populate a collection which supports paging.



_________________________________

Visit my blog at http://leedumond.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datatable Limno .NET Framework 1.x 0 May 28th, 2008 02:37 PM
Error-Object does not support doesn't support this bootsy Classic ASP Basics 1 May 25th, 2008 07:14 PM
DataTable and Database collie ASP.NET 1.x and 2.0 Application Design 3 August 7th, 2007 11:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.