Solved

Display Multiple Lines In ListBox Control

Posted on 2007-12-02
3
1,079 Views
Last Modified: 2013-11-26
I'm using ASP.NET 2.0.  Is there a way to make a listbox display multiple lines (wrapped) within a row?  Also, is there a way to set the background color of a specific row?

Thanks
0
Comment
Question by:Ray Turner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20393925
0
 
LVL 21

Accepted Solution

by:
surajguptha earned 250 total points
ID: 20393932
oops.. I meant giving you this link
http://www.codeproject.com/aspnet/ColorListBox.asp
0
 
LVL 6

Assisted Solution

by:CasUK
CasUK earned 250 total points
ID: 20394063
If you're using ASP - then you're probably writing a webpage.

The problem you have is that I'm not aware of a way to create multi-line listboxes without the resorting to Javascript in pages (which would lead to other problems anyway)

I would probaby use the OPTGROUP tag to group the different lines. Use the same value for each subsequent line in the group so that it can be selected.

As for colouring them, some basic CSS would do the trick - I've put some inline CSS in the code to keep it simple.

Although you can still only select one line at a time, the illusion of a multiline box is there. I hope this helps.
<select size="6">
<optgroup label="John Doe" style="background-color:red; color=white;">
<option value ="johndoe">123 My Road</option>
<option value ="johndoe">My Town</option>
</optgroup>
<optgroup label="Jane Doe" style="background-color:yellow; color:blue;">
<option value ="janedoe">456 My Road</option>
<option value ="janedoe">My Town</option>
</optgroup>
</select>

Open in new window

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question