Sam Sam - 1 year ago 99
ASP.NET (C#) Question

description with double quotes

in i'm using

to display products from DB.

all works fine, but i have an anchor using PrettyPhoto to display description about the product in popup. but i noticed when the description starts or contains double quotes is not showing in my popup!

this is my anchor:

<a href="WEBIMAGES/<%#Eval("FirmName")%>/<%# Eval("PicturName") %>" rel="prettyPhoto" title="<%#Eval("FirmName") %>&nbsp;-&nbsp;<%#Eval("ItemName") %>" style="color: #f1652f;vertical-align:bottom;" >More Details</a>

i tried to use @ in front of itemName to escape double quotes but not working.

Anyone had this problem before?

Thank you!

Answer Source

Use Single Quote to avoid your problem like below

<a href="WEBIMAGES/<%#Eval('FirmName')%>/<%# Eval('PicturName') %>" rel="prettyPhoto" title='<%#Eval("FirmName") %>&nbsp;-&nbsp;<%#Eval("ItemName") %>' style="color: #f1652f;vertical-align:bottom;" >More Details</a>