473,397 Members | 2,068 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,397 software developers and data experts.

How do I stop the framework from HTML escaping my text?

Hello,

I am populating a drop down list at run time, and the text going in
includes a pound sign. I have been trying to add the item like this...

drpFerret.Items.Add(new ListItem("Ferrets £9.99"));

but the framework HTML encodes this, resulting in the "£" being
sent out as "£" which does not display how I want.

Any ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 8 '06 #1
6 1225
How about this:

drpFerret.Items.Add(new ListItem("Ferrets #9.99"));

and the framework should take care of the encoding.

Jun 8 '06 #2
In article <11**********************@j55g2000cwa.googlegroups .com>, Q.
John Chen <qj****@email.com> writes
How about this:

drpFerret.Items.Add(new ListItem("Ferrets #9.99"));

and the framework should take care of the encoding.


How will that help? I want a pound sign, not a # sign.

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 8 '06 #3
Alan Silver wrote:
Hello,

I am populating a drop down list at run time, and the text going in
includes a pound sign. I have been trying to add the item like this...

drpFerret.Items.Add(new ListItem("Ferrets &pound;9.99"));

but the framework HTML encodes this, resulting in the "&pound;" being
sent out as "&amp;pound;" which does not display how I want.

How about

drpFerret.Items.Add(new ListItem("Ferrets " & Chr(156) & "9.99"));

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 8 '06 #4
In article <eD**************@TK2MSFTNGP02.phx.gbl>, "Bob Barrows [MVP]"
<re******@NOyahoo.SPAMcom> writes
I am populating a drop down list at run time, and the text going in
includes a pound sign. I have been trying to add the item like this...

drpFerret.Items.Add(new ListItem("Ferrets &pound;9.99"));

but the framework HTML encodes this, resulting in the "&pound;" being
sent out as "&amp;pound;" which does not display how I want.

How about

drpFerret.Items.Add(new ListItem("Ferrets " & Chr(156) & "9.99"));


Huh? That shows up as a little square box. Were you thinking of
chr(163), which is the ASCII code for the pound sign? If so, then this
doesn't answer my question as I want the HTML entity code for a pound
sign, so that people who don't necessarily have a UK language set up
will also see a pound sign. Putting the pound sign in as a character is
fine for UK people, but not for the rest of the world.

What I want is to end up with "Ferret &pound;9.99"

Thanks anyway, any other ideas?

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 12 '06 #5
Alan Silver wrote:
In article <eD**************@TK2MSFTNGP02.phx.gbl>, "Bob Barrows
[MVP]" <re******@NOyahoo.SPAMcom> writes
I am populating a drop down list at run time, and the text going in
includes a pound sign. I have been trying to add the item like
this...

drpFerret.Items.Add(new ListItem("Ferrets &pound;9.99"));

but the framework HTML encodes this, resulting in the "&pound;"
being sent out as "&amp;pound;" which does not display how I want.
How about

drpFerret.Items.Add(new ListItem("Ferrets " & Chr(156) & "9.99"));


Huh? That shows up as a little square box. Were you thinking of
chr(163), which is the ASCII code for the pound sign?


Oops, yes I was ... how did that happen?
If so, then this
doesn't answer my question as I want the HTML entity code for a pound
sign, so that people who don't necessarily have a UK language set up
will also see a pound sign. Putting the pound sign in as a character
is fine for UK people, but not for the rest of the world.

What I want is to end up with "Ferret &pound;9.99"

Thanks anyway, any other ideas?

--
Alan Silver
(anything added below this line is nothing to do with me)


I don't get it. Why doesn't this work for you? Here's what I get when I
try it:

<option value="Ferrets £9.99">Ferrets £9.99</option>

Is "&pound;" so different from "£"? "&pound;" is just the named
(aliased) version of
"£" isn't it?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 12 '06 #6
In article <uz**************@TK2MSFTNGP05.phx.gbl>, "Bob Barrows [MVP]"
<re******@NOyahoo.SPAMcom> writes
I don't get it. Why doesn't this work for you?


I just realised what you were trying to do, and I further realised that
the way I tried it wasn't doing the same thing!! I am using C# not VB,
so I converted your chr(163) into the wrong C# equivalent. Once I
realised what you meant, I was able to do it.

Thanks very much. Sorry for missing the point <g>

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 12 '06 #7

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

Similar topics

0
by: James T Jordan | last post by:
Hi, I am quite frustrated with the problem I was given to solve. I have xsl as input which outputs html but some of the html is coded like &lt;tag&gt and I need to remove the html formatting from the...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
5
by: Jim Bancroft | last post by:
Hi everyone, I receive XML documents which sometimes have HTML in the element content. When performing XSL transformations the HTML text is escaped, which affects us when we eventually display...
18
by: Robert Bowen | last post by:
Hello peeplez. I have an odd problem. When I put the ANSI symbol for "less than" ("<"), the word STRONG and then the ANSI symbol for "greater than" (">") in my web page, followed by some text, then...
8
by: Jochen Stuempfig | last post by:
hello, i'd like to store text in an database and generate html files with the text stored in the database. i use dom to generate an xml file and render it using xsl. i use the following code to...
6
by: Abhishek Srivastava | last post by:
Hello All, I am developing a page which has a complex layout. This layout cannot be made using VS alone, so I have to go into the html view and edit the html myself. The problem is that...
8
by: Brian | last post by:
I was wondering if anyone here on the group could point me in a direction that would expllaing how to use python to convert a tsv file to html. I have been searching for a resource but have only...
5
by: eva.mukhija | last post by:
Hi I need to insert some html content generated by certain business logic into an xsl output. I have been able to insert custom Java extensions and generate the HTML to be outputted. My problem...
4
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.