Web Wiz - Solar Powered Eco Hosting

  New Posts New Posts RSS Feed - DetailsView AutoPaging Disappears.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

DetailsView AutoPaging Disappears.

 Post Reply Post Reply
Author
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post Topic: DetailsView AutoPaging Disappears.
    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.
Back to Top
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
michael View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4673
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post 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.


Edited by michael - 29 November 2005 at 4:05pm
Back to Top
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post Posted: 03 December 2005 at 11:56pm
Thanks Michael. :-)
David.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.01
Copyright ©2001-2018 Web Wiz Ltd.


Become a Fan on Facebook Follow us on Twitter Connect with us on LinkedIn Community Forums Web Wiz Blogs Web Wiz News
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2019 Web Wiz Ltd. All rights reserved.