Sam Sam - 18 days ago 7
ASP.NET (C#) Question

description with double quotes

in asp.net i'm using

ListView
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

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>
Comments