Solved

Indenting text items in a ASP.Net 2.0 ListBox

Posted on 2007-03-20
5
514 Views
Last Modified: 2013-11-26
Hi,

I have an application that builds an itinerary. I have the origin, destinations/stopovers and vias added to the same listbox. I have a checkbox that the user can check to indicate that this part of the itinerary is a 'via' i.e. the user wants to go via this city but this is not a stopover or destination where they will actually stop.

For example, a person goes from Chicago to Orlando stopping in Nashville but going via Louisville, KY.

So the listbox should be:

Chicago (origin)
Nashville (stopover)
-->Louisville (indented by tab or spaces to indicate it is a 'via')
Orlando (final destination)

How can this best be accomplished?

Thanks in advance.

Chad
0
Comment
Question by:chad_sriram
  • 3
  • 2
5 Comments
 

Author Comment

by:chad_sriram
Comment Utility
Any ideas, fellas?

Chad
0
 
LVL 1

Expert Comment

by:whylogin
Comment Utility
Not sure if this will work but try adding $nbsp; in front of the listbox item text, add it multiple times for multiple spaces.  I didn't test this out but it may work.  Also you can just create a custom control that either uses a table or span tags and then you can control the exact location of the text depending on what it is.
0
 
LVL 1

Expert Comment

by:whylogin
Comment Utility
sorry its not $nbsp; its      having a bad typing day.
0
 

Author Comment

by:chad_sriram
Comment Utility
I tried

strVia = "Nashville";
 
ListBoxViaList.Items.Add("   " + strVia );

The item displays as    Nashville in my listbox item.
 
It does not render the &nbsp right, must be something that ASP.Net listbox is picky about.
0
 
LVL 1

Accepted Solution

by:
whylogin earned 500 total points
Comment Utility
You can try something like this,  once again I haven't tried this.

strVia = (Char)32 + "Nashville";

Generally what I would do in this case is just create a custom control that displays a table.  Then you can control the spacing, padding, alignment and everything using css.

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now