473,471 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Control properties with entity references declared in ASPX get converted to character values

Group,

I have created a User Control with the property "Html" of type string.
If I declare this control on an ASPX page with the value "<b>This is an
entity: &lt;</b>" for the property "Html", the ASP.NET parser seems to
automatically convert the entity reference "&lt;" to it's corresponding
character value "<".

For example, if the tagprefix and tagname for the user control is "dn"
and "test":

<dn:test Html="<b>This is an entity: &lt;</b>" id="test" runat="server"
/>

.... this will result in a "Html" value of:

"<b>This is an entity: <</b>"

Why does this happen? It is quite annoying because I need to preserve
the entity reference. Is there any way to preserve entity references in
properties of type string when these are specified declaratively?

Thank you!

Feb 13 '06 #1
2 1279
DWS
Jesl,
Take a look at the httpserverutility methods. htmlencode and htmldecode.
These two methods change string to from &lt to < etc.

http://msdn2.microsoft.com/en-us/lib...y_members.aspx
Good Luck
DWS


"je**@lundbeck.com" wrote:
Group,

I have created a User Control with the property "Html" of type string.
If I declare this control on an ASPX page with the value "<b>This is an
entity: <</b>" for the property "Html", the ASP.NET parser seems to
automatically convert the entity reference "<" to it's corresponding
character value "<".

For example, if the tagprefix and tagname for the user control is "dn"
and "test":

<dn:test Html="<b>This is an entity: <</b>" id="test" runat="server"
/>

.... this will result in a "Html" value of:

"<b>This is an entity: <</b>"

Why does this happen? It is quite annoying because I need to preserve
the entity reference. Is there any way to preserve entity references in
properties of type string when these are specified declaratively?

Thank you!

Feb 14 '06 #2
Thank you, but the problem is that the entity refrences get converted
even before I can get hold of the string value. Remember: I am reading
a string property set declaratively in the ASPX. I suspect that the
problem is that it is the default TypeConverter for strings in the
ASP.NET framework that is the culprit. Any thoughts on that or how to
write an alternative TypeConverter that does not touch the string?

/jesper

Feb 15 '06 #3

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

Similar topics

11
by: Douglas Reith | last post by:
Hi There, Can someone please tell me why the XML spec states that an attribute value with an external entity is forbidden? Or point me to the appropriate document? Or better still, perhaps you...
9
by: ckerns | last post by:
I want to loop thru an array of controls,(39 of them...defaults = 0). If value is null or non-numeric I want to assign the value of "0". rowString = "L411" //conrol name if (isNaN(eval...
5
by: Stephan Hoffmann | last post by:
Hi, I use XML mainly as a source for HTML. HTML browsers 'know' certain entity references like &eacute; or &auml;. When I use XSL to transform XML to HTML or XML, these entities are replaced...
9
by: lkrubner | last post by:
Can't get this RSS feed clean: http://www.whatisliberalism.com/pdsFiles/page2533.xml Why is it dying? Some users write posts in Microsoft Word, then copy and paste their post to the web...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
by: Tuomas Rannikko | last post by:
Hello, I'm currently writing a XML processor for the fun of it. There is something I don't understand in the spec though. I'm obviously missing something important. The spec states that both...
11
by: Jean-François Michaud | last post by:
Hello all, I'm having a little problem, The UTF-8 parser we are using converts the newline entity ( ) within an attribute that we are using to paliate CSS limitations. After the parser has...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
18
by: R. P. | last post by:
I wonder how to indicate in a stylesheet that character entities in an element are not to be transformed as would be the case in XML-to-XML transforms. I want to keep those &amp; &quot; and other character...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.