[thelist] .NET [C#], DropDownList, HTMLEncode

jason.handby jason.handby at corestar.co.uk
Tue Sep 5 12:54:36 CDT 2006

Hi Chris,

I think Matt is right.

> I am not a .NET guy, but nothing I can find in the docs 
> suggests that the string passed to the constructor will be 
> interpreted as markup. I suspect it is simply a string of 
> characters. If they are characters you can't figure out how 
> to type or otherwise can't declare them literally, you will 
> need to represent them another way. Most languages have 
> something like chr(10) and such, to convert from ascii (or 
> other) code to the character.

You could try using Server.HtmlDecode()? I haven't tested it but it
might be worth a go. This assumes your code is within a class that
derives from Page (i.e. within the code-behind of a web page):

	DropDownList languageDropDownList = new DropDownList();

	string s = "Ελληνικά";
ListItem(Server.HtmlDecode(s), "gr"));


More information about the thelist mailing list