• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

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

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?

bd
0
brooklynDev
Asked:
brooklynDev
2 Solutions
 
quanmacCommented:
Try this:

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

that might get rid of the '&' characters being displayed.
0
 
raterusCommented:
Try something like this, you just need to use another character,

string padding = "\xA0\xA0";
ddlItems.Add(new ListItem(padding + "Hello World","123"));
0
 
brooklynDevAuthor Commented:
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.

bd
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now