Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving displayed records up and down

Status
Not open for further replies.

Beat

Technical User
Aug 26, 2001
41
SE
How can I let the user to move the displayed records up and down with for example arrows?

I want to use it to sort the items in a dynamic textbased menu. The menu items are just records extracted from a table in the database.

Thanks!
 
Hi,

Not sure I understand what you want to do, are you saying you want to move SEPARATE records around?

If you want to be able to re-sort columns based on A-Z or 1-9 values, then look at Tom Muck's extension over at basic-ultradev.com, he has a variety of pretty useful extensions, some free others not.

If that's wide of the mark, please elaborate

M "There are 3 kinds of people; those that can count and those that can't"
 
I want to be able to manually sort the listed records on the display page by clicking arrows up and down.

The listed records are menuitems and to build the menu dynamically I want to let the user to sort their menu in their admin section manually in any order they want, just by moving an item upwards or downwards.

Makes sense?

Thanks!
 
I think it was T-Cubed that had a nice tutorial on this.

works great too.

Ok heres a recordset - you'll need to do some hand tweaking here. by altering to fit your items.


<%
Dim rsDelete__name
rsDelete__name =
[/color red]&quot;modelnumber&quot; [/color]
if (Request.QueryString(&quot;order&quot;) <> &quot;&quot;) then rsDelete__name = Request.QueryString(&quot;order&quot;)
%>
<%
Dim rsDelete__sort
rsDelete__sort = &quot;ASC&quot;
if (Request.QueryString(&quot;sort&quot;) <> &quot;&quot;) then rsDelete__sort = Request.QueryString(&quot;sort&quot;)
%>
<%
set rsDelete = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsDelete.ActiveConnection = MM_your_STRING
rsDelete.Source = &quot;SELECT * FROM yourtable ORDER BY &quot; + Replace(rsDelete__name, &quot;'&quot;, &quot;''&quot;) + &quot; &quot; + Replace(rsDelete__sort, &quot;'&quot;, &quot;''&quot;) + &quot;&quot;
rsDelete.CursorType = 0
rsDelete.CursorLocation = 2
rsDelete.LockType = 3
rsDelete.Open()
rsDelete_numRows = 0
%>


Note what is in red you need to replace to what you want the default sort to be by.

now on the table you'd do this.

Lets say this is one of your cells. with the header.


<td width=&quot;42&quot;>
<div align=&quot;center&quot;>ID<br>
<a href&quot;
yourpage.asp?order=ID&sort=DESC&quot;><img src=&quot;images/uparrow.gif&quot; width=&quot;10&quot; height=&quot;10&quot; border=&quot;0&quot;></a>
<a href=&quot;yourpage.asp?order=ID&sort=DESC&quot;><img src=&quot;images/dwnarrow.gif&quot; width=&quot;10&quot; height=&quot;10&quot; border=&quot;0&quot;></a>
</div>
</td>

now the red you need to change to be the same page as the one your sorting. ID change to your table field name your sorting by. lemme find some arrow links for you too.


You'll want to recolor them I'm sure.

Hollar if you run into problems &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
ahhh disregard the [/color red] part. oops.

And note too - DW will from the moment you put that in there - HATE the code.

But have no fear. Just set up the recordset first the way you like it to be (for page layout) - then cut and paste the above into your page overwriting the recordset you did.

&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top