HtmlEncode bound data

D

David

Hi,

I have a gridview where I am hand binding the data.

In my view, I have a label. It has the text as text='<%# Bind("MyField")
%>'

I have incoming data that may contain < and >. I need to HTML Encode this,
but I can't get it to work.

text='<%# Server.HtmlEncode(Bind("MyField")) %>'

I have tried changing the Bind to DataBinder.Eval(Container.DataItem,
"MyField") and wrapping the HtmlEncode around it, but it doesn't work.

What should I be doing?

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top