473,657 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Paging, subsorting issue...

Can anyone point me to a code example where a recordset.absol utepage is sorted independantly of the original recordset. That is; if I populate an ADO recordset with an ORDER BY ListingDate clause, and I need to (subsort) recordset.absol utepage five of my paging on another field, say for example AskingPrice, I'm stuck.

My goal is for my users to be able to page through my recordset, sort a page if desired, and continue through the recordset. The records on any page are sorted, and the same records are displayed, just in a new (subsort) oder.

I'm not using the data controls, just plain ASP...

Thanks

Kev

Current code below...
<!--#include file="Utilities .asp"-->
<link href="styles/main.css" rel="stylesheet " type="text/css">
<!--#include file="header.as p"-->
<!--#include file="Menu.asp"-->
<%
check_security( 2)
%>
<%

If Session("UserID ") = "" Then
Response.Redire ct "Login.asp"
End if

Dim rsItems, strSort

strSort = request("sortby ")

strSQL = "SELECT Item.ItemID, Users.CompanyNa me, EquipmentTypes. EquipName, Item.EquipmentT ype, Item.LoadSize, Item.PickupDate , Item.SPCountry, Item.SPState, " & _
"Item.SPCit y, Item.DPCountry, Item.DPState, Item.DPCity, Item.Descriptio n, Item.AskingPric e, Item.SellerID, Item.ListingDat e, Item.Expiration Date, Item.ItemStatus " & _
"FROM (Item INNER JOIN EquipmentTypes ON Item.EquipmentT ype = EquipmentTypes. EquipCode) LEFT JOIN Users ON Item.SellerID = Users.UserID " & _
"WHERE Item.Expiration Date > #" & FormatDateTime( Now,2) & "# " & _
"AND ItemStatus = 'Active' "

If request("LoadSi ze") <> "" then
strSQL = strSQL & "AND LoadSize = '" & request("LoadSi ze") & "' "
End if

If request("Equipm entType") <> "" then
strSQL = strSQL & "AND EquipmentType = '" & request("Equipm entType") & "' "
End if

If request("SPCoun try") <> "" then
strSQL = strSQL & "AND SPCountry = '" & request("SPCoun try") & "' "
End if

If request("SPStat e") <> "" then
strSQL = strSQL & "AND SPState = '" & request("SPStat e") & "' "
End if

If request("DPCoun try") <> "" then
strSQL = strSQL & "AND DPCountry = '" & request("DPCoun try") & "' "
End if

If request("DPStat e") <> "" then
strSQL = strSQL & "AND DPState = '" & request("DPStat e") & "' "
End if

strSQL = strSQL & "ORDER BY PickupDate;"

page_no = request("page_n o")
if page_no = "" then page_no = 1

Set rsItems = Server.CreateOb ject("ADODB.Rec ordset")

if strSql <> "" then
rsItems.CursorL ocation = 3
rsItems.CacheSi ze = 5
rsItems.Sort = "PickupDate , " & strSort
rsItems.Open strSql, objConn
if not rsItems.EOF then
rsItems.MoveFir st
rsItems.PageSiz e = 5
max_count = cInt(rsItems.Pa geCount)
num_recs = rsItems.RecordC ount
rsItems.Absolut ePage = page_no
results = true
for each tmp in request.queryst ring
if tmp <> "page_no" AND tmp <> "sortby" then
request_string = request_string & tmp & "=" & request.queryst ring(tmp) & "&"
end if
next
else
results = false
rsItems.Close
end if
else
results = false
end if
rec_count = 0
%>
<table cellpadding="0" cellspacing="0" >
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><h1>Brows e Loads</h1></td>
</tr>
<tr>
<td><li>Click Company Name to bid on the load.</li>
<li>Click the column headers to sort each Pickup Date by the column name.</li>
<li>Place your mouse over the Type code to see the full type description.</li>
<li>You cannot bid on your own loads.</li></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<%

if results = true then

%>
<table width="760px" cellpadding='0' cellspacing='0' >
<tr>
<td class='tdHeader '>Company</td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=LoadS ize">Size</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Equip mentType">Type</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Picku pDate">Pickup Date</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=SPCit y">Starting Point</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=DPCit y">Destinati on</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Askin gPrice">Payment Amt</a></td>
</tr>
<%

do while not rsItems.EOF AND (rec_count < rsItems.Pagesiz e)

on error resume next

%>
<tr>
<% If Session("UserID ") <> "" AND Session("UserID ") <> rsItems("Seller ID") Then %>
<td align="left" class='tdData'> <a href='Bid.asp?I tem=<%=rsItems( "ItemID")%>'><% =rsItems("ItemR eference")%></a></td>
<% Else %>
<td class='tdData' align='left'><% =rsItems("ItemR eference")%></td>
<% End If %>
<td class='tdData' align='center'> <%= rsItems("LoadSi ze") %></td>
<td class='tdData' align='center'> <a title='<%=rsIte ms("EquipName") %>'><%=rsItems( "EquipmentType" )%></a></td>
<td align='center' class='tdData'> <%= rsItems("Pickup Date")%></td>
<td align='left' nowrap class='tdData'> &nbsp;<a href="http://www.mapquest.co m/maps/map.adp?country =<%=rsItems("SP Country")%>&sta te=<%=rsItems(" SPState")%>&cit y=<%=rsItems("S PCity")%>&CID=l fmaplink" target="_blank" ><font color="#FF0000" size="1">Map</font></a>&nbsp;<%= rsItems("SPCity ") & ", " & rsItems("SPStat e")%></td>
<td align='left' nowrap class='tdData'> &nbsp;<a href="http://www.mapquest.co m/maps/map.adp?country =<%=rsItems("DP Country")%>&sta te=<%=rsItems(" DPState")%>&cit y=<%=rsItems("D PCity")%>&CID=l fmaplink" target="_blank" ><font color="#FF0000" size="1">Map</font></a>&nbsp;<%= rsItems("DPCity ") & ", " & rsItems("DPStat e") %></td>
<td class='tdData' align='right'>< %= formatcurrency( rsItems("Asking Price")) %>&nbsp;</td>
</tr>
<%
rsItems.MoveNex t
rec_count = rec_count + 1
loop
rsItems.Close
Set rsItems = Nothing
%>
</table>
<% else %>
<center>
<h2>No loads currently listed</h2>
</center>
<%

end if

if max_count > 1 then

%>
<table width="760px" cellpadding="0" cellspacing="0" class="NavTable ">
<tr>
<td align=center width="20%" class=NavFont>< % if page_no > 1 then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=1&sor tby=<% =request("sortb y")%>">First </a>
<% else %>
<% end if %>
</td>
<td align=center width="20%" class=NavFont>< % if page_no > 1 then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =page_no-1 %>&sortby=<%=re quest("sortby") %>">Previous</a>
<% else %>
<% end if %>
</td>
<td align=center width="20%" class=NavFont> Records:&nbsp;< %=num_recs%> </td>
<td align=center width="20%" class=NavFont>< % if cInt(page_no) < cInt(max_count) then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =page_no+1 %>&sortby=<% =request("sortb y")%>">Next</a>
<% end if %>
</td>
<td align=center width="20%" class=NavFont>< % if cInt(page_no) < cInt(max_count) then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =cInt(max_count ) %>&sortby=<% =request("sortb y")%>">Last</a>
<% end if %>
</td>
</tr>
</table>
<% end if %>
<!--#include file="footer.as p"-->

Nov 19 '05 #1
0 960

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5038
by: Mark | last post by:
I am attempting to build a repeating list using a repeater control. I want to add a checkbox to each item (line) and 'Select All' and 'Clear All' buttons. I have figured out how to do this until it comes time to implement paging. Without paging I can iterate through the repeater when I click 'Select All' and set the checked property to true for all items in the repeater. However when I implement paging, I have to rebind the repeater...
2
2577
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has to be scrolled down completely to see the page number links. The page number should always be visible outside the scroll bar. Basically I want to create the paging links dynamically and on click of this it should fire PageIndexChanged event.
4
1527
by: Ken Varn | last post by:
I am displaying data from a SQL Server database on my ASP.NET web form. The data table that I am displaying is huge and it must be paged. What I would like to do is display 10 records at a time and allow the user to jump to a particular page if they desire. I would like my interface to display the total number of pages and offer the user the ability to select which page they would like to display. I have not figured out how I can do...
4
1477
by: news.microsoft.com | last post by:
I've looked in the help and at each of the properties for the grid view, but can't seem to find what I need. I have allowpaging set to true for my gridview and when the page loads I go and fetch 75 records from the DB, I know there are 750 records total in the DB. How can I control the paging? I don't want to go and get all 750 records at once then allow the grid view to do the paging. Currently the biggest issue I'm facing is how to...
5
1905
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records then the number of rows I'd like to display, I'd like to be able to load pages into the grid. My question is, do I need to continually hit the db to get the next page of records, or is there another method of doing with the dataset. i.e. load the
0
1137
by: pmohando | last post by:
DB2 version 7 running on Aix 5.3 platform, we face the problem on paging space keeping on increasing and reaches upto 99% and only solution is server made to restart for every 20 days. DB2 is not clearing the used paging space to free up the space. It occpies all the paging space on the server. Pls suggest a solution for this issue ASAP. Thanks in advance.
1
2669
by: John Mott | last post by:
Hi All, I recently read a post that said that google and other spiders are unable to navigate paging in the GridView control because it uses postbacks and it can't determine the url. I've verified that it doesn't see portions of my site that are on page 2 and beyond according to whats generated. This is not a good thing if your want people to find your stuff.
8
1895
tharden3
by: tharden3 | last post by:
Hey all, I need some help with PHP code for paging my products on my site. I posted questions asking for help in the past, and was directed to this tutorial for help. The code that the tutorial gives is great, but I'm having a hard time synchronizing it with my own code to make the whole thing work. My goal is to take four basic product details: $thumb (a thumbnail that will go along with its corresponding info) $type (the 'type' of...
1
1768
by: chris3vic | last post by:
I have a dynamically created datagrid, populated from a dataset that is filled by a sql string triggered by a command button. The application itself allows a user to input a selection of criteria and hit search, the results ome back in the grid. Due to the probably amount of records that will be returd, I decided to allow paging to make the data more visually appealing. So far, so good. Everything is running smoothly until.. you try to selct...
0
8395
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.