Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add spaces in drop-down list
Message
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01539933
Message ID:
01539941
Views:
34
>>Hi,
>>
>>I have a drop-down list control on the form. The .DataSource of this control is a dataview (from a dataset) created with the following SQL Select
>>
>>
>>select MyField1, MyField2 from MyTable
>>
>>
>>I want to create a column that will have MyField1 and then bunch of spaces and then MyField2. But when I add space to the SQL Select, the spaces are not shown. If I add '& + 'nbsp' + ';' still does not work. Here is an example of what I tried:
>>
>>
>>select MyField1 + '            '  + MyField2 as MyField3 from MyTable
>>
>>or
>>
>>select MyField1 + '&' + 'nbsp' + ';' + '&' + 'nbsp' + ';' '  + MyField2 as MyField3 from MyTable
>>
>>
>>
>>What would you suggest?
>
>UPDATE. Here is the solution:
>
>
>foreach (ListItem item in ddlist.Items) 
> { 
>    item.Text = HttpUtility.HtmlDecode(item.Text); 
> }
>
You may also want to take a look at the HtmlHelper class for things like this. It is in the MVC namespace but there is no reason you can't use it in non-MVC apps.

Isn't your monthly day off coming up? <g>

Wow, look at the calendar. Happy April Fool's Day, everyone. Now I just have to think of a prank and who to play it on.

I think my favorite was a few months after Emily's second grade class had a lice infestation. Just about all the kids got it, as did Emily's sister and mom. (I was spared, probably due to my head being a less hospitable host environment). What a nightmare that was. It went on for weeks, literally. All it took was one classmate who still had lice and then they would spread all over again. Just try keeping second graders out of close proximity with each other. Every night we would go through both girls' hair with fine toothed combs and magnifying glasses, a process that took half an hour or so. Then we checked each other's heads. All the bedding had to be washed every night. One disgusting attempt at eradication involved copious amounts of mayonnaise under shower caps. (I passed on that one). Some of the boys' moms got them crewcuts. I dubbed them the Hair Club For Men. We were close to trying kerosene, which our pediatrician said is an approach used in Israel. Finally, mercifully, there were five clean days in a row and we let life return to normal. At the time the family was still together, Tricia working downtown and me working at home. After picking the girls up from school on April Fool's Day I told them my evil plan. They laughed in delight. With the girls right next to me, waiting to deliver their one line, I called Tricia at her office. "The girls are both saying their heads itch," I said. Hook, line, and sinker. "Oh, no. Oh, God." I let it rest for a few seconds, then gave Allie and Emily their cue. "April Fool!" Tricia was NOT amused. She might laugh about it now. Maybe.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform