Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 17th, 2007, 05:08 AM
Registered User
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AsadRaza
Default Problem in retreiving muliti selection list

In the name of Allah the most Merciful Beneficent

I m facing problem in retreiving previously selected items in a multiselection list. Say, I selected four items from a list of 6 but when I retreive the rcords from database for updation I find only one highlighted. What I want is : all the items previously selected should be highlighted at updation.
I have tried Split and arrays but it's not working.

PLease help if any of you can,
Old February 18th, 2007, 09:03 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

May I ask you for an explanation of this statement?:
;;;In the name of Allah the most Merciful Beneficent

Re your problem:
You should be posting your problematic code. You will not get far here asking people to write code for you. Perhaps if you posted the code that resulted in this statement:

'I have tried Split and arrays but it's not working'

Someone would correct your incorrect code. Instead, here is a working example of how you would achieve this objective (cut directly from one of my working pages):

Get the master list for the select box (groups in this case):
sql = "SELECT ID,shortName FROM groups where ..."
set getInfo = conn.execute(sql)

Get the options that should be selected for a given user (userGroups has a one to many relationship with the groups table - A user can be a member of many groups):
sql = "SELECT gid from userGroups WHERE uId = " & cint(getEditInfo(0)) & ";"
set getTest = conn.execute(sql)

Here is the looping conditional multiselect box:

<% if not getInfo.EoF Then %>
       <select name="gId" style="width:151" multiple size="5">
<% do until getInfo.EoF %>
          <option value="<%= getInfo(0) %>"
          <% if edit = true then
                do until getTest.Eof
                   if cint(getTest(0)) = cint(getInfo(0)) then
                      response.write " selected "
                   end if
             end if%>><%= getInfo(1) %></option>
<% getInfo.moveNext
    else %>
        <I class="note">No groups found</i>
<% end if %>

Wind is your friend

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pre-filtering a selection list asearle XSLT 4 November 7th, 2006 09:24 AM
how to automate selection of items from list satish_k VB How-To 0 October 6th, 2006 06:44 AM
Data List Selection Norberto_Caraballo Beginning VB 6 1 June 24th, 2006 09:41 AM
problem in retreiving db fields in the text boxes umair_rathore Access ASP 1 February 17th, 2005 05:01 PM
Menu / Dropdown List Selection Reduction larry101 Javascript How-To 2 September 20th, 2004 03:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.