Print Page | Close Window

DetailsView AutoPaging Disappears.

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17380
Printed Date: 28 March 2026 at 9:40pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: DetailsView AutoPaging Disappears.
Posted By: davidshq
Subject: DetailsView AutoPaging Disappears.
Date Posted: 28 November 2005 at 11:15pm
So, paging on the DetailsView is a nice feature. But say you have 400 records. You don't want your visitor to have to pay through 10 by 10 until they finally reach record 392. Rather you want them to be able to type in the record they want and grab it. No problem. You drop in a TextBox and a Button control. On Click for the Button you change the DefaultValue of the ID variable, so that pull the 392nd record instead of the 1st. Hmmm...Except for now your handy little AutoPaging feature is gone. It shows the record gone, but you can't page forward or backwards. What a sad predicament...Any ideas how I can escape it?
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Replies:
Posted By: davidshq
Date Posted: 28 November 2005 at 11:25pm
Okay, I figured out that the Select Where ID=@varID was my problem. I was only requesting one item from the database, and so there were no records to page through. But how then does one select a specific record from the returned set to focus on? I thought maybe DetailsView.PageIndex would help, but while it appears close it chose ID 180 rather than 175 (as I entered). Is there an easy way to tell it what ID it is to select?

-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.


Posted By: michael
Date Posted: 29 November 2005 at 4:03pm
Actually PageIndex is the right method to call. If you do

DetailsView1.PageIndex = TextBox1.Text - 1

It will bring you to the correct page, not based on the id though as ID 55 could be on page 53 in case 2 id's have been deleted. The -1 is because the PI is zero based.
 
Basically, when you enter say 55, you want to be on PAGE 55 not call the ID 55 right? If you want to make that ID based you set the Datakeyvalues easier yet, create a view using the new SQL 2005 Rownum methods and index based on the Row Number, that way you are always in synch.


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: davidshq
Date Posted: 03 December 2005 at 11:56pm
Thanks Michael. :-)
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net