tags:

views:

29

answers:

3

I have a field with product name

abc® product1

If I get the data from the database and databind it to the dropdownlist. It becomes

<option value="2">abc &amp;reg;  product1</option>

I don't want ASP.net to escape the &reg; to %amp;reg. What should I do?

+1  A: 

In your database you shouldn't store abc&reg; product1 but abc® product1. Then when this value is rendered on the page you need to HTML encode it which happens automatically if you use <asp:DropDownList.

Darin Dimitrov
I cannot change the database data. What should I do? Encode the string again in databinding method?
Billy
A: 
TAkinremi
Why is it bad? It's a legitimate string representing a registered trademarked name, just stored in slightly the wrong way.
slugster
Opps I didn't mean for it to acually show the (r) symbol but it did. What are you trying to do? Because you have a "Field" with one value in it, but you're puting it in a DropDown control?
TAkinremi
A: 

You want to HTML encode the string prior to it being shown in the HTML. This will preserve its name

m.edmondson