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

Robert Vreeland vreeland at studioframework.com
Thu Sep 7 10:24:16 CDT 2006


Chris,
Ok, the problem is not your dropdownlist per say, it's that the default
implementation of the HtmlTextWriter that your page is using is html
encoding entity characters, by default. So unless you want to write a custom
control that implements it's own htmlTextWriter you need to decode your
input before adding it to the dropdownlist and you may, I'm not positive on
this, need to override localization so the browser does not then translate
your text into the default langue of the user - like English. That said,
here is a example (lifted and modified from Microsoft) of using HtmlDecode:

<snip>
String EncodedString = "&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;";
StringWriter writer = new StringWriter();
Server.HtmlDecode(EncodedString, writer);
String DecodedString = writer.ToString();
this.languageDropDownList.Items.Add(new
	ListItem(DecodedString , "gr"));
</snip>

Sincerely,
Robert Vreeland

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Chris at globet.com
Sent: Thursday, September 07, 2006 10:27 AM
To: thelist at lists.evolt.org
Cc: Chris at globet.com
Subject: Re: [thelist] .NET [C#], DropDownList, HTMLEncode

Robert

> Sorry if this has already been suggested, but have you tried 
> designating your input as a verbatim string literal? You do so by 
> putting an @ before the leading  double quote like so:

No joy :(

[..]

--
Chris Marsh
Software Developer
t: +44 20 8246 4804 x828
f: +44 20 8246 4808
e: chris at globet.com
w: http://www.globet.com/

Any opinions expressed in this email are those of the individual and not
necessarily the Company. This message is intended for the use of the
individual or entity to which it is addressed and may contain information
that is confidential and privileged and exempt from disclosure under
applicable law. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution, or copying of
this communication is strictly prohibited.
If you have received this communication in error, please contact the sender
immediately and delete it from your system. 
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 




More information about the thelist mailing list