Lets say I have the following code and there is a specific item that I would like to indent in the list box. How would I go about doing this without using any item templates? I know in classic asp, you can use " ", but this doesn't seem to work.
Using code behind, there is no way that I can get this to work. I tried spaces, they are automatically trimmed when added to the list box. is not recognized using code behind, if i put it in quotes the the result in the listbox would be " Itemx"; Any other
suggestions?
Using C# code-behind it does not seem to work. Could anyone post an example, like the one I used above, showing how this could be done. That would help me alot.
ok... you're quite right - it doesn't work! But (if I've got my C right - sorry, I'm a VB man myself.....) try this for the relevant line: ListBox1.Items.Add(Server.HTMLDecode(" ")+"item"+q); it's a little ugly, but it works.... NB note the HTML this generates:
Two ie, a leading space gets added to the value as well, which you may or may not need to be aware of... cheers Phil
R03
Member
455 Points
91 Posts
How do you indent items in a listbox?
Sep 19, 2003 05:14 AM|LINK
for(int q=0; q<4; q++) { if(q==2) { //indent this item ListBox1.Items.Add("item"+q); } else ListBox1.Items.Add("item"+q); }Atrax
All-Star
18705 Points
3733 Posts
Re: How do you indent items in a listbox?
Sep 19, 2003 08:51 AM|LINK
Jason Brown - MVP, IIS
R03
Member
455 Points
91 Posts
Re: How do you indent items in a listbox?
Sep 19, 2003 02:43 PM|LINK
gmphil
Member
80 Points
16 Posts
Re: How do you indent items in a listbox?
Sep 19, 2003 10:26 PM|LINK
R03
Member
455 Points
91 Posts
Re: How do you indent items in a listbox?
Sep 20, 2003 08:56 PM|LINK
gmphil
Member
80 Points
16 Posts
Re: How do you indent items in a listbox?
Sep 20, 2003 09:42 PM|LINK
R03
Member
455 Points
91 Posts
Re: How do you indent items in a listbox?
Sep 21, 2003 05:44 AM|LINK