 |
| ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP Forms 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
|
|
|
|

December 3rd, 2004, 02:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to highlight selected data
Hi
I am working on ASP.I have one registration form on which i am using a dropdown list for multiple selection.In the update profile i want to hightlight the selected values in the dropdownlist.
I hope i am clear to explain my need.
Plz help me in this regard.
Regards
Lily
|
|

December 4th, 2004, 06:11 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Are you building the drop-down dynamically? If so, just add selected="selected" to the items you need to select, as in the following pseudo code:
Code:
<select>
<%
For Each Record in your Drop Down Items
If Record Matches User's selection
Response.Write("<option value="Something" select="selected">Something</option>")
Else
Response.Write("<option value="Something">Something</option>")
End If
Next
%>
</select>
If you're not building the drop-down dynamically, you probably should change that so you *do* build it dynamically. ALternatively, you can use client side JavaScript to preselect the items...
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The man with the red face by Laurent Garnier (Track 7 from the album: Unreasonable Behaviour) What's This?
|
|

December 4th, 2004, 07:04 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is my dropdown list values where there are multiple values selected.
<SELECT size=3 name=Updateme multiple>
<OPTION value="None">None</OPTION>
<OPTION value="Recruitment & Retention">Recruitment & Retention</OPTION>
<OPTION value="People Management">People Management</OPTION>
<OPTION value="Organisational Behaviour">Organisational Behaviour </OPTION>
<OPTION value="Performance Management" >Performance Management</OPTION>
<OPTION value="Strategic HRM" >Strategic HRM</OPTION>
<OPTION value="Training & Development" >Training & Development</OPTION>
<OPTION value="HR Practices">HR Practices</OPTION>
</SELECT>
from the database the value="<%=objrs("areas")%>"
How to display the multiple selected values in the drop down list.
|
|

December 4th, 2004, 07:06 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
And what does <%=objrs("areas")%> contain??
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The Tourist by Radiohead (Track 12 from the album: OK Computer) What's This?
|
|

December 4th, 2004, 08:26 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
objrs("areas") contains Recruitment & Retention,People Management,Organisational Behaviour .
Data is storing into the database with commas.
|
|

December 4th, 2004, 08:36 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
In that case, the pseudo code will look like this:
Code:
<select>
<%
' Split objrs("areas") into an array
For Each Record in your Drop Down Items
For Each Item in the Areas Array
If Record Matches Item From Areas Array
Response.Write("<option value="Something" select="selected">Something</option>")
Else
Response.Write("<option value="Something">Something</option>")
End If
Next
Next
%>
</select>
Does this make any sense?
Imar
--------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

December 4th, 2004, 08:38 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am very new in ASP programming, can u give the code and how to split the array.
|
|

December 4th, 2004, 08:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Dim myArray
myArray = Split("YourCommaSeparatedString", ",")
Also, look here:
http://www.google.com/search?hl=en&q...=Google+Search
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |