🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.aspdotnet.components.using
Article #22

Re: D2005 Datagrid paging

#22
From: Bob Swart
Date: Sun, 07 Jan 2007 10:30
31 lines
2277 bytes
Hi James,

> I am trying to use a datagrid control and enable paging. No matter what I do I get the following errror: 
> Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
> even though if I step through and debug I see that the pageindex I am attempting to set (1) is less than the page count (2). 

But when you call DataBind on the DataGrid again, does the DataGrid's 
DataSource still contain the data? Did you re-execute the query, or 
obtain the data from a cache (like the session for example?).

Note that if you use BdpDataAdapter, then leaving the Active property 
set to True will do the trick (it's not as efficient as storing the 
result in the session, but at least ensures the query will always be 
re-executed).

> I have searched for this message in the newsgroups and cannot find any answer that applies. Has anyone had this problem and been able to resolve it? 

See 
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401swart/ 
for an example how to do it using BdpDataAdapter.

> Thanks,
> James

Groetjes,
           Bob Swart

-- 
Bob Swart Training & Consultancy (eBob42.com)  Forever Loyal to Delphi
Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml
New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware
Technical Details
Message-ID: <45A0CBC6.4090602@chello.nl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <459d2f1e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 21665a,5bca6ea60c26735f
X-Google-Attributes: gid21665a,public
X-Google-Language: ENGLISH,ASCII-7-bit
Message-ID: <45A0CBC6.4090602@chello.nl>
Date: Sun, 07 Jan 2007 11:30:30 +0100
From: Bob Swart <b.swart@chello.nl>
Organization: Bob Swart Training & Consultancy (eBob42)
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.aspdotnet.components.using
Subject: Re: D2005 Datagrid paging 
References: <459d2f1e$1@newsgroups.borland.com>
In-Reply-To: <459d2f1e$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.93.59.184
X-Trace: newsgroups.borland.com 1168165777 213.93.59.184 (7 Jan 2007 02:29:37 -0800)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail