www.webdeveloper.com
Results 1 to 3 of 3

Thread: ASP Listbox

  1. #1
    Join Date
    Jan 2005
    Location
    Singapore
    Posts
    47

    Question ASP Listbox

    Hi i need help with listbox asp..

    The form does updating.
    So the selected listbox should display the original record from the database
    AND the remaining other values that the user can choose to edit.

    When the page loads, it simplys load all the available options.
    However i cant seem to display the original record FIRST when the page loads.

    I want to be able to show the original record when the page loads and then when the user clicks on the dropdown menu, the other
    options are available.

    i hope u guys understand what i mean

    anyway this is what i have done..
    it simply displays all the records in the listbox.
    Code:
    <%=Request.Form("login")%>
     <tr>
      <td bgcolor="#000080" align=middle><font size='2' face='Tahoma' color='#ffffff'><b>Login Type</font></B></td>
      <td><SELECT name=login LANGUAGE=javascript onchange="return dept_onchange(thisForm)">
       <%
    	Set oRs=Server.CreateObject("adodb.recordset")
    	strSQL = "SELECT DISTINCT LOGINTYPE FROM SUNDER.MOBILE_USERS_NEW "
    	strSQL = strSQL & " ORDER BY LOGINTYPE"
    	oRs.Open strSQL, conn
    	Do while not oRs.EOF
    	   if Request.Form("login") = oRs("LOGINTYPE") then
    		  Response.Write "<OPTION VALUE = '" & oRS ("LOGINTYPE") & "' SELECTED>"
    		  Response.Write oRs("LOGINTYPE") & "</Option>"
    		  oRs.MoveNext
    	   else
    		  Response.Write "<OPTION VALUE = '" & oRs ("LOGINTYPE") & "'>"
    		  Response.Write oRs("LOGINTYPE") & "</Option>"
    		  oRs.MoveNext
    	   end if
    	loop
    	%></SELECT></td>
     </tr>
    Pls help.. thanks alot..
    Vj

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    What is "the original record"?

  3. #3
    Join Date
    Jan 2005
    Location
    Singapore
    Posts
    47
    Okay lets say i have a table of cars (mini, benz, ferrari)

    And Owner X owns a mini
    So when the form loads, the listbox should display mini.
    when i click on the listbox the other cars must be displayed in the listbox so tht i can edit..

    Currently the problem im facing is when the form is loaded the listbox simplies displays all the cars in alphabatical order..

    so how i make sure the listbox displays the original record then upon click it displays the rest . ?
    Vj

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles