View Full Version : XTemplate img src issue

10 Sep 2010, 9:42 AM
I have an issue with a template I am using inside of a data view. The template works fine for all fields except for the field specified in the src attribute of the image which never gets replaced.

var data = [{"ProductID":1122010101,"Name":"1 Box MonaVie Active Gel - (28 packets)","Description":null,"BasePrice":0.0,"ListPrice":72.5000,"DisplayPrice":"$72.50","WholesalePrice":72.5000,"MSRP":0.0,"SKU":1122010101,"Volume":50.0000,"WebName":null,"ImageID":0,"ThumbnailImageID":0,"ImagePath":"/Content/Images/Products/default_product.png", "ImagePath":"TestImg.jpg"}];

<div id="template">
<tpl for=".">
<div id='product-{SKU}' class='product'>
Path: {ImagePath}<br />
<img src='{ImagePath}' alt='Product Image' title='{Name}' /><br />
<span class='name'>{Name}</span><br />
Price: {DisplayPrice}<br />
Volume: {Volume}<br />
Qty: <input type='text' id='tbQty-{SKU}' style='width: 30px' /><br />
<input type='button' value='Add to Cart' onclick='AddItemToCart({SKU}); return false;' />
The odd thing is that the first {ImagePath} gets replaced correctly, but the one in the src attr of the img tag does not. Any suggestions?

10 Sep 2010, 10:11 AM
Show actual code.