We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Auto Html Encoding - I'd like to really use the & character, can I disable .net auto encode?

brooklynDev asked
Medium Priority
Last Modified: 2010-06-21
I have some code as such:

DropDown.Items.Add(new ListItem("text before space     text after space", ""));

I'd like to use the none breaking spaces but .net automatically encodes the ampersand characters. Is there a way around this auto encoding?

Watch Question

Try this:

DropDown.Items.Add(new ListItem(@"text before space     text after space", ""));

that might get rid of the '&' characters being displayed.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Top Expert 2005
Try something like this, you just need to use another character,

string padding = "\xA0\xA0";
ddlItems.Add(new ListItem(padding + "Hello World","123"));


My deepest and most sincere apologies for letting this question go unattended. There were extenuating circumstances but I will make sure it never happens again.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.