Author: strangeduck | Posted on: 4/3/2004 5:51:22 AM | Views : 491

In one of my .aspx files I have a custom control with an attribute called comment. I want to assign it a string with a quote inside - but the problem is that sometimes these quotes contain both single and double quotes, so I don't know how to contain it. Example:

I want to make the comment say
Bob's hairdresser said "Hi."

<item:ImageItem ...... comment="Bob's hairdresser said "Hi."" /> <!-- doesn't work, obviously -->
<item:ImageItem ...... comment='Bob's hairdresser said "Hi."' /> <!-- doesn't either -->

It's not really any great big surprise to me that those don't work, but I can't figure out what escape sequences HTML (or ASP.NET) uses so that I can escape the single/double quotes that occur in the attribute. Any ideas? ...

Go to the complete details ...