When I apply the next/previous navigation to the page every record is
displayed 10 times.  The data renders perfectly until I apply this
navigation feature, which I have to do because there will be too many
records displayed if someone uses the "ALL" option.

Steve LaBadie, Web Manager
East Stroudsburg University
200 Prospect St.
East Stroudsburg, Pa 18301
570-422-3999
[EMAIL PROTECTED]
http://www.esu.edu
-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 12, 2006 2:09 PM
To: CF-Talk
Subject: RE: Previous/Next Button Issue

Without troubleshooting the code, what's the problem you are having? 

-----Original Message-----
From: Steve LaBadie [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 12, 2006 1:45 PM
To: CF-Talk
Subject: Previous/Next Button Issue

I am trying to apply a previous next button and limit the records to 10.
When the page views the data replicated 10 times for each record.

 

 

This code generates the data:

<cfoutput>

<cfif CurrentRow MOD 2 is 1>

<cfset bgcolor = "##f2f2f3">

<cfelse>

<cfset bgcolor = "##ffffff">

</cfif>

<cfloop query="GetExp" startrow="#URL.StartRow#" endrow="#EndRow#">

<tr bgcolor="#bgcolor#" class="font8"><td class="red"><a
href="EmpDetail.cfm?emp_id=<cfoutput>#URLEncodedFormat(queryGrid.e_emp_i
d)#</cfoutput>&<cfoutput>#transitparams#</cfoutput>"
class="red">#fldname#</a></td>

<td class="font8">#fldtitle#</td>

<td class="font8">#fldwork_phone#</td></cfloop>

</tr>

</cfoutput></cfloop>

 

This code handles the record count:

<!--- Retrieve expense records from database --->

<cfquery name="GetExp" datasource="empldir">

SELECT *

FROM emps

ORDER BY name ASC

</cfquery>

 

<!--- Number of rows to display per Next/Back page  --->

<cfset RowsPerPage = 10>

<!--- What row to start at? Assume first by default --->

<cfparam name="URL.StartRow" default="1" type="numeric">

 

<!--- We know the total number of rows from query   --->

<cfset TotalRows = GetExp.RecordCount>

<!--- Last row is 10 rows past the starting row, or --->

<!--- total number of query rows, whichever is less --->

<cfset EndRow = Min(URL.StartRow + RowsPerPage - 1, TotalRows)>

<!--- Next button goes to 1 past current end row  --->

<cfset StartRowNext = EndRow + 1>

<!--- Back button goes back N rows from start row --->

<cfset StartRowBack = URL.StartRow - RowsPerPage>

 

 

Steve LaBadie, Web Manager
East Stroudsburg University
200 Prospect St.
East Stroudsburg, Pa 18301
570-422-3999
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.esu.edu <http://www3.esu.edu> 

 







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263794
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to