473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HtmlEncode bound data

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
Jun 27 '08 #1
1 1411
I guess I have a problem and no easy solution...

Anybody? Even if just a thought to try and get it working?
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:eo**************@TK2MSFTNGP02.phx.gbl...
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

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: abcd | last post by:
Simple but not working at this moment I have to fill the HTML select control.... my values could be for example "test number 1" sample code, dim x Data = "test ...
0
by: Michal Raatz | last post by:
Welcome. I have a common problem with the datagrid: when the data source contains html tags (<script>document.location.href='www.badsite.com'</script> for example) the page with the datagrid...
8
by: AFN | last post by:
I want to have a routine in a page base class that will take all the text fields on a web form, and then HtmlEncode their values. I'm having trouble figuring out if I want to loop controls or...
0
by: Chris Leffer | last post by:
Hi. I am having problems to use HtmlEncode with strings that use accents. My page uses some expressions like that: <%# Server.HtmlEncode(DataBinder.Eval(Container.DataItem, "Name").Trim) %> ...
1
by: M | last post by:
I would thought the DataGrid would HtmlEncode everything before displaying. It appears that it does not. Isn't that a security concern? Anyway to force the DataGrid to HtmlEncode? Thanks.
3
by: David Lozzi | last post by:
Howdy, I have my left navigation of Hyperlinks, and part of the link's querystring is the title of the page they are going to. For example, one of the pages is Cars & Trucks. With HtmlEncode, it...
2
by: jMehdi | last post by:
I have the following definition: <asp:BoundField DataField="ThreadPostAuthor" HeaderText="<%$ Resources:ForumsRes, StartedBy %>" SortExpression="ThreadPostAuthor" HtmlEncode="false" /> When...
1
by: Alexander Higgins | last post by:
>>Thanks for the response.... Point Taken but this is not the case. Thus, if a person writes a text file on her or his computer and does not use UNICODE to save it, the current code page is...
7
by: jaja | last post by:
Hello all, I am familiar with the HtmlEncode Server method. I also read this : http://msdn2.microsoft.com/en-us/library/a2a4yykt(VS.80).aspx My question is: If I want to encode all inputs from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.