473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Literal space in a DropDownList

I'm trying to insert space characters into some ListItems in a DropDownList.
However, ASP.NET is converting my " " into " ". Anyone know
how to insert literal spaces when populating a DDL programmatically?

--
Jon Sagara
Nov 18 '05 #1
3 2237
Did you try adding the space chars directly without   ?
Eg: DropdownList.Items.Add (" ");

"Jon Sagara" <jo*******@yahoo.com> wrote in message
news:#m**************@TK2MSFTNGP15.phx.gbl...
I'm trying to insert space characters into some ListItems in a DropDownList.
However, ASP.NET is converting my "&nbsp;" into "&amp;nbsp;". Anyone know
how to insert literal spaces when populating a DDL programmatically?

--
Jon Sagara

Nov 18 '05 #2
Yep. Just like in an HTML page, they are not rendered as spaces.

I have a temporary workaround -- instead of spaces, I am using dashes.

Thanks,

--
Jon Sagara

"Shiva" <sh******@online.excite.com> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
Did you try adding the space chars directly without &nbsp; ?
Eg: DropdownList.Items.Add (" ");

"Jon Sagara" <jo*******@yahoo.com> wrote in message
news:#m**************@TK2MSFTNGP15.phx.gbl...
I'm trying to insert space characters into some ListItems in a DropDownList. However, ASP.NET is converting my "&nbsp;" into "&amp;nbsp;". Anyone know
how to insert literal spaces when populating a DDL programmatically?

--
Jon Sagara

Nov 18 '05 #3
You could resolve this problem by using Server.HTMLDecode.
For example, when you add a new item to the list that should be displayed
as "1 3", you use

DropDownList1.Items.Add(Server.HtmlDecode("1&nbsp; &nbsp;3"));

This should solve your problem.
Regards
Mohamed El Ashmawy
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: NancyASAP | last post by:
In case anyone hasn't seen this problem, just sharing the info.... I created a dotnet 1.1 page with a literal control. I used a streamreader to open a text file to fill the control. I filled the...
9
by: Steven T. Hatton | last post by:
This is from the draft of the previous version of the Standard: http://www.kuzbass.ru:8086/docs/isocpp/expr.html 2- A literal is a primary expression. Its type depends on its form...
7
by: herrcho | last post by:
i'm in the course of learning C, and found these two words "string, string literal" confusing me.. I'd like to know the difference between them.. Thank you
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
4
by: songkv | last post by:
Hi, I am trying to reassign an array of char to a string literal by calling a function. In the function I use pointer-to-pointer since I want to reassign the "string array pointer" to the string...
4
by: TJS | last post by:
I am populating a droplist control from a query. each line of content in the dropdownlist gets "trimmed" automatically . how can I force a leading space to a line in a dropdown list ??
0
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
0
by: John Smith | last post by:
This is what I am trying to do: <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"...
33
by: bearophileHUGS | last post by:
I have just re-read the list of changes in Python 2.6, it's huge, there are tons of changes and improvements, I'm really impressed: http://docs.python.org/dev/whatsnew/2.6.html I'll need many...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.