Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 29th, 2009, 07:53 AM
Authorized User
 
Join Date: Mar 2007
Location: , , Denmark.
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default Paging in listview, using paging in stored procedures

Has anyone successfully used a ListView control instead of a GridView in theBeerHouse, and maintaining the paging used in the stored procedures?

Just hooking it up to a DataPager control would, in theory, mean that all records would be retrieved, which is not the meaning in theBeerHouse. (I say "in theory", because I haven't been able to compile and test the things I have tried so far)

My idea was to somehow set the value for PageSize and PageIndex in the ObjectDataSource, from the values in the DataPager, based on a buttons CommandValue, or from a number in the NumericPagerField.

I noticed that the ObjectDataSource has the "MaximumRowsParameterName" and "StartRowIndexParameterName" properties, which can be used when paging is enabled.

These would be set to PageSize and PageIndex, as parameters for ex. GetArticles right? Is it possible to set these parameter values based on the values from the DataPager, and keep track of them in ViewState?

Any ideas?

Thnx
  #2 (permalink)  
Old January 30th, 2009, 09:54 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Yes, I've replaced the GridView in the ArticlesListing.ascx user control.

It is a little tricky replicating the exact behavior of the GridView (making the pager disappear when all records are displayed; doing the location highlighting, resetting the page index) but it is all doable. I plan to write a blog post or two on the ListView in the very near future.

Fortunately however, server-side paging is not tricky at all.

If you have an ObjectDataSource with paging enabled = true (you do) and the Select method you indicate for it has paging parameters named startRowIndex and maximumRows (it does), then you are all set.

The DataPager has read-only properties named StartRowIndex and MaximumRows. Their values will automatically be passed to the ODS Select method as arguments for the startRowIndex and maximumRows parameters. You don't have to do this manually at all. (In fact, you can't, because the buttons in the DataPager do not have CommandValues, only CommandNames.)

DataPager values are also automatically tracked in ViewState.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}

Last edited by Lee Dumond; January 30th, 2009 at 10:51 PM.
The Following User Says Thank You to Lee Dumond For This Useful Post:
philthy (February 15th, 2009)
  #3 (permalink)  
Old November 11th, 2012, 06:03 PM
Authorized User
Points: 76, Level: 1
Points: 76, Level: 1 Points: 76, Level: 1 Points: 76, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm interested in replacing my GridViews with ListViews, did you ever get round to writing the blog post your mentioned, or can you share how to do this?

Cheers
 


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DB recordset paging using ajax paging? kumiko Classic ASP Basics 0 May 26th, 2008 10:23 AM
Paging fadyratl VB Databases Basics 0 December 27th, 2006 04:04 AM
paging folders solomon_13000 Classic ASP Professional 1 May 28th, 2006 09:12 AM
Problem with my paging... fung Classic ASP Databases 2 August 23rd, 2004 07:43 AM



All times are GMT -4. The time now is 02:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.