Welcome to Dream.In.Code
Become an Expert!

Join 150,118 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,975 people online right now. Registration is fast and FREE... Join Now!




ASP drop down not sorting correctly. Please help

 
Reply to this topicStart new topic

ASP drop down not sorting correctly. Please help

mlordi28
20 Jun, 2008 - 06:11 AM
Post #1

New D.I.C Head
*

Joined: 20 Jun, 2008
Posts: 1

I have a dynamic drop down that is being populated by a table in an access 2000 database. The problem is that the drop-down box will only initially select the cities that start with A if I sort decending. When I try and sort Ascending it starts at Zion. How can I shift the cities starting with A to the top and initially select it in the drop down box?

Here is an example of me creating this with Abbott Park selected first but I must sort it descending to do it.
http://146.145.180.7/LimoCorpChicago/default.asp

CODE


[b]SELECT STATEMENT[/b]
<%
Dim rsZones
Dim rsZones_numRows

Set rsZones = Server.CreateObject("ADODB.Recordset")
rsZones.ActiveConnection = MM_LimoCorp_STRING
rsZones.Source = "SELECT City FROM Zones ORDER BY City DESC"
rsZones.CursorType = 0
rsZones.CursorLocation = 2
rsZones.LockType = 1
rsZones.Open()

rsZones_numRows = 0
%>


[b]DROP DOWN BOX[/b]
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Destination:</strong><br />
    <select name="Destination" id="Destination">
      <%
While (NOT rsZones.EOF)
%>
      <option value="<%=(rsZones.Fields.Item("City").Value)%>" <%If (Not isNull((rsZones.Fields.Item("City").Value))) Then If (CStr(rsZones.Fields.Item("City").Value) = CStr((rsZones.Fields.Item("City").Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(rsZones.Fields.Item("City").Value)%></option>
      <%
  rsZones.MoveNext()
Wend
If (rsZones.CursorType > 0) Then
  rsZones.MoveFirst
Else
  rsZones.Requery
End If
%>
    </select>
  </font></p>

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 01:14AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month