Home All Groups Group Topic Archive Search About

DataGrid doesn't do HTML entity encoding.

Author
20 Mar 2005 1:39 PM
Chris Mumford
I have a DataGrid bound to a table where one of the strings is "<Unknown>".
When this is sent out via the DataGrid control as HTML it is not encoded and
therefore it looks like a tag in the HTML stream. What I would expect is
"&lt;Unknown&gt;". Does anybody know how to make this happen?

Author
20 Mar 2005 7:30 PM
Elton Wang
You can use

String.Replace("<","&lt;").Replace(">","&gt;")

HTH

Elton Wang
elton_w***@hotmail.com

>-----Original Message-----
>I have a DataGrid bound to a table where one of the
strings is "<Unknown>".
>When this is sent out via the DataGrid control as HTML it
is not encoded and
>therefore it looks like a tag in the HTML stream. What I
would expect is
Show quoteHide quote
>"<Unknown>". Does anybody know how to make this happen?
>
>
>.
>