473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Need multi select combo/list box on ASP page

20
Hi,

I need a multi select combo box on ASP page.

Scenario: on page there is a table with few columns. In multi select box, i need all the table columns,let user select a few, and show only those columns in the table which user has selected.
Feb 19 '10 #1
7 4774
CroCrew
564 Expert 512MB
Hello usr123,

What have you coded so far? Please post what you have so far so we can provide you with the assistance you’re looking for.

Happy Coding,
CroCrew~
Feb 19 '10 #2
usr123
20
This shows the columns.

Expand|Select|Wrap|Line Numbers
  1. <td height="20" id= "tcol1"><b><a href="live.asp?sort=old_wkctr&filter_wo=<%=request("filter_wo")%>&filter_column=<%=request("filter_column")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">W/C</a></b></td>
  2.           <td height="20" id= "tcol2"><b><a href="live.asp?sort=old_job&filter_wo=<%=request("filter_wo")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">W/O</a></b></td>
  3.           <td height="20" id= "tcol3"><b><a href="live.asp?sort=old_part&filter_wo=<%=request("filter_wo")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">Part</a></b></td>
  4.           <td height="20" id= "tcol4"><b>Description</b></td>



Data for these columns is:

Expand|Select|Wrap|Line Numbers
  1. <td bgcolor="#FFFFFF" width="7%"><%=oRS("old_wkctr")%></td>
  2.         <td bgcolor="#FFFFFF" nowrap><a title="<%=oRS("commentary")%>" href="javascript: popup_small('edit_commentary.asp?work_order=<%=oRS("old_job")%>&commentary=<%=oRS("commentary")%>')"><%=oRS("old_job")%></a> </td>
  3.         <td bgcolor="#FFFFFF" nowrap><%=oRS("old_part")%></td>
  4.         <td bgcolor="#FFFFFF" width="8%"><%=oRS("pt_desc1")%></td>
Feb 19 '10 #3
usr123
20
i have got multi select check boxes:

Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.             <td>
  3.                 <input type="checkbox" name="W/C" onclick="toggleVis(this.name)" checked>W/C<input type="checkbox" name="W/O" onclick="toggleVis(this.name)" checked>W/O
  4.                 <input type="checkbox" name="Part" onclick="toggleVis(this.name)" checked>Part<input type="checkbox" name="Description" onclick="toggleVis(this.name)" checked>Description
  5.             </td>
  6.           </tr> 
Or i can have something like:

Expand|Select|Wrap|Line Numbers
  1. <tr> 
  2.            <td width="20%" colspan="2">
  3.               <select name="filter_type" class="form_textbox" multiple = "multiple" size ="5" >
  4.                 <option value="">-Please choose-</option>
  5.                 <option value="old_wkctr" <%if request("filter_column") = "old_wkctr" then%>selected<%end if%>>W/C</option>
  6.                 <option value="commentary" <%if request("filter_column") = "commentary" then%>selected<%end if%>>W/O</option>
  7.                 <option value="old_part" <%if request("filter_column") = "old_part" then%>selected<%end if%>>Part</option>
  8.                 <option value="pt_desc1" <%if request("filter_column") = "pt_desc1" then%>selected<%end if%>>Op</option>          
  9.               </select>
  10.             </td>
  11.           </tr>
In either option, i need to check at column level if its checked(in case of checkboxes) or selected(in case of Multi select combo), i couldnt figure out so far how to do that....
Feb 19 '10 #4
usr123
20
If its selected or if its checked, i need to make visible true or false.
Feb 19 '10 #5
CroCrew
564 Expert 512MB
What exactly do you need to make visible or not?
Feb 19 '10 #6
usr123
20
The columns:
Expand|Select|Wrap|Line Numbers
  1. <td height="20" id= "tcol1"><b><a href="live.asp?sort=old_wkctr&filter_wo=<%=request("filter_wo")%>&filter_column=<%=request("filter_column")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">W/C</a></b></td> 
  2.           <td height="20" id= "tcol2"><b><a href="live.asp?sort=old_job&filter_wo=<%=request("filter_wo")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">W/O</a></b></td> 
  3.           <td height="20" id= "tcol3"><b><a href="live.asp?sort=old_part&filter_wo=<%=request("filter_wo")%>&filter_op=<%=request("filter_op")%>&filter_part=<%=request("filter_part")%>&filter_type=<%=request("filter_type")%>&filter_wkctr=<%=request("filter_wkctr")%>&filter_dept=<%=request("filter_dept")%>&filter_000=<%=show_000%>&w=<%=filter_w%>&q=<%=filter_q%>&Prelim=<%=filter_Prelim%>">Part</a></b></td> 
  4.           <td height="20" id= "tcol4"><b>Description</b></td> 
For example: If 'W/C' is selected or checked, it should be visible otherwise not.
Feb 19 '10 #7
CroCrew
564 Expert 512MB
Ok, here is an example of what you can do using JavaScript. First let me give some insight on what the page does and then the code.

Function:
ShowHideColumn (CommonFieldNamePart, MaxRowNum, obj)

Definition:
{CommonFieldNamePart} is the beginning part of the “name” that is shared by all of the fields/columns that this function will be updating.
{MaxRowNum} is number of fields that this function will be updating. If there are three rows in the table then you would pass ‘3’ for the “MaxRowNum” value.
{obj} Just always pass “this.name“ as the value. In the checkbox properties make sure that the “name” value of the check box is the same as the “CommonFieldNamePart” value.

Note:
For this function to work properly an understanding that all the Columns that are going to be grouped together will need to share in a common name part for each row.

Here is a example of the whole page at work:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Example</title>
  4.         <script type="text/javascript">
  5.             function ShowHideColumn(CommonFieldNamePart, MaxRowNum, obj)
  6.             {
  7.                 for (i = 1; i <= MaxRowNum; i++)
  8.                 {
  9.                     if (document.getElementById(obj).checked)
  10.                     {
  11.                         document.getElementById(CommonFieldNamePart + i).style.display='none';
  12.                     }
  13.                     else
  14.                     {
  15.                         document.getElementById(CommonFieldNamePart + i).style.display='';
  16.                     }
  17.                 }
  18.             }
  19.         </script>        
  20.     </head>
  21.     <body>
  22.         <p>
  23.             Hide Column A: <input type="checkbox" name="ColumnA" onclick="ShowHideColumn('ColumnA', 2, this.name)"><br />
  24.             Hide Column B: <input type="checkbox" name="ColumnB" onclick="ShowHideColumn('ColumnB', 2, this.name)"><br />
  25.             Hide Column C: <input type="checkbox" name="ColumnC" onclick="ShowHideColumn('ColumnC', 2, this.name)"><br />
  26.             Hide Column D: <input type="checkbox" name="ColumnD" onclick="ShowHideColumn('ColumnD', 2, this.name)">
  27.         </p>
  28.  
  29.         <table border="1" bordercolor="#000000">
  30.             <tr>
  31.                 <td id="ColumnA1">Dane</td>
  32.                 <td id="ColumnB1">Sam</td>
  33.                 <td id="ColumnC1">Ed</td>
  34.                 <td id="ColumnD1">Bill</td>
  35.             </tr>
  36.             <tr>
  37.                 <td id="ColumnA2">Jurkovic</td>
  38.                 <td id="ColumnB2">Dawwod</td>
  39.                 <td id="ColumnC2">Kodish</td>
  40.                 <td id="ColumnD2">Chasse’</td>
  41.             </tr>
  42.         </table>
  43.     </body>
  44. </html>
  45.  
Hope this helps,
CroCrew~
Feb 19 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Diane Yocom | last post by:
Has anybody ever seen or written code for ASP that would mimic Access' multi-column combo box? Specifically, I have a drop down box that lists about 100 five-digit codes. Each of these codes has...
6
by: Robin S. | last post by:
Originally I wanted a list box which selects which record is the current one within the same form. Easy enough until Access takes a dump when one is deleted and then someone tries to select it in...
17
by: Aussie Rules | last post by:
Hi, I want to have a single line combo box dropdown, but where i can selected multiple items in the drop down via a check box... I can see one in the standard tool box... is there one ? If...
4
by: snowweb | last post by:
I am trying to implement a CSS hierarchical unfolding menu on a site. The thing is, it needs to be dynamically populated from the results of a database query. I previously had the menu working but...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
10
by: SM | last post by:
Hello I'm trying to create a multi dimensional array in JavaScript, but after some reading i still can't figure out how to apply it to my model. Here it is: I have a list A and for each item...
1
by: Tuku | last post by:
I want a combo box through which i can select multiple values.Like a list box. Can you please help?
1
by: freetime | last post by:
Greetings, This is my first post so I will try to be brief and accurate. I have a report that uses 9 user selectable filters (Dates, Y/N's as Combo Boxes and 4 Multi-Select List Boxes. ...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.