RePost: Populating list boxes

  • Thread starter Thread starter Jeremy Ames
  • Start date Start date
J

Jeremy Ames

[Original Message]
I am trying to add info into a list box but I am having problems. I am
trying to load the information into a tabular format within the list box,
but when I try to space everything out, I get unexpected results. When I use
spaces to move everything around the text moves no more than one space, the
text only moves one space. If I try to use tabs, I get the same result. If I
try to put in  , I get &ampnbsp;. I am not sure what I am doing wrong.
Can someone please help?
[/Original Message]

In a reply that I received, someone suggested to use a list view. I do not
see a list view in my list of components for web forms. Am I not
understanding the lingo or is the list view for windows forms and not web
forms?
 
You may get a better solution somewhere else (I'd take a look to see if
anyone has implemented web forms controls with columns), but for now, you
can get around your problem by doing this:

1) Go to the HTML view of your page.
2) Find the code for your Listbox.
3) For the appropriate listbox items, you can apply spacing like so:

<asp:ListItem Value="big space">big &nbsp;&nbsp;&nbsp;&nbsp;
space</asp:ListItem>

Erik
 
The problem I have with that is that when I try to do that dynamically, it
shows &nbsp; instead of spaces in the list box. I can do that when I put
them in at design time.

You may get a better solution somewhere else (I'd take a look to see if
anyone has implemented web forms controls with columns), but for now, you
can get around your problem by doing this:

1) Go to the HTML view of your page.
2) Find the code for your Listbox.
3) For the appropriate listbox items, you can apply spacing like so:

<asp:ListItem Value="big space">big &nbsp;&nbsp;&nbsp;&nbsp;
space</asp:ListItem>

Erik
 
Oh, you mean at run-time? Try this:

char nbsp = (char) 0xA0;
ListBox1.Items.Add("big" + nbsp + nbsp + nbsp + nbsp + nbsp + nbsp + nbsp
+ nbsp + "space");

Jeremy Ames said:
The problem I have with that is that when I try to do that dynamically, it
shows &nbsp; instead of spaces in the list box. I can do that when I put
them in at design time.

You may get a better solution somewhere else (I'd take a look to see if
anyone has implemented web forms controls with columns), but for now, you
can get around your problem by doing this:

1) Go to the HTML view of your page.
2) Find the code for your Listbox.
3) For the appropriate listbox items, you can apply spacing like so:

<asp:ListItem Value="big space">big &nbsp;&nbsp;&nbsp;&nbsp;
space</asp:ListItem>

Erik

Jeremy Ames said:
[Original Message]
I am trying to add info into a list box but I am having problems. I am
trying to load the information into a tabular format within the list box,
but when I try to space everything out, I get unexpected results. When I use
spaces to move everything around the text moves no more than one space, the
text only moves one space. If I try to use tabs, I get the same result.
If
I
try to put in &nbsp;, I get &ampnbsp;. I am not sure what I am doing wrong.
Can someone please help?
[/Original Message]

In a reply that I received, someone suggested to use a list view. I do not
see a list view in my list of components for web forms. Am I not
understanding the lingo or is the list view for windows forms and not web
forms?
 
That is it! Thank you so very much. I have been working with that problem
for at least 3 weeks. I had long since run out of ideas.

Oh, you mean at run-time? Try this:

char nbsp = (char) 0xA0;
ListBox1.Items.Add("big" + nbsp + nbsp + nbsp + nbsp + nbsp + nbsp + nbsp
+ nbsp + "space");

Jeremy Ames said:
The problem I have with that is that when I try to do that dynamically, it
shows &nbsp; instead of spaces in the list box. I can do that when I put
them in at design time.

You may get a better solution somewhere else (I'd take a look to see if
anyone has implemented web forms controls with columns), but for now, you
can get around your problem by doing this:

1) Go to the HTML view of your page.
2) Find the code for your Listbox.
3) For the appropriate listbox items, you can apply spacing like so:

<asp:ListItem Value="big space">big &nbsp;&nbsp;&nbsp;&nbsp;
space</asp:ListItem>

Erik

Jeremy Ames said:
[Original Message]
I am trying to add info into a list box but I am having problems. I am
trying to load the information into a tabular format within the list box,
but when I try to space everything out, I get unexpected results. When I use
spaces to move everything around the text moves no more than one space, the
text only moves one space. If I try to use tabs, I get the same result.
If
I
try to put in &nbsp;, I get &ampnbsp;. I am not sure what I am doing wrong.
Can someone please help?
[/Original Message]

In a reply that I received, someone suggested to use a list view. I do not
see a list view in my list of components for web forms. Am I not
understanding the lingo or is the list view for windows forms and not web
forms?
 
Back
Top