HariP

Hi,

I want to display the images in the Product List page. I modified the code in ProductList.aspx.

Here is my code snippet

<asp:HyperLink ID="ImageURL" runat="server" EnableViewState="false"
NavigateUrl='<%# this.GetItemUrlString(Container.DataItem) %>'>
<asp:Image runat="server" ImageUrl='<%# ((Microsoft.CommerceServer.Catalog.CatalogItemsDataSet.CatalogItem)Container.DataItem)["Image_filename"].ToString()%>'
AlternateText="<%# Eval(DisplayNameColumnName) %>" width="130" height="113" />
</asp:HyperLink>

This Code complies correctly.

But the Problem is,

I have given the imagefilepath value as "./Images/<filename>". This is how they have given for other images in the starter site. Thats why the images are displayed in the product detail page(which lies in the root folder).

This gives me the problem.

Because the ProductList page lies in Control folder. So the image path is coming as "http://localhost/StarterSite/Controls/images/<filename>". So the image is not getting dispalyed.

Kindly help me out in this issue.


Re: Commerce Server 2007 Problem in dispalying images in Product List page

Hoonius

try setting them as "~/Images/<filename>" in imagefilepath

the ~ normally indicates the root directory in asp.net apps.

alternatively, there is a CommerceServer function for this as well

CommerceComponents.Common.ComponentCommon.ConvertApplicationUrl("~/Images/hoonzcrazyimage.gif")

should provide the information as well

hope this helps





Re: Commerce Server 2007 Problem in dispalying images in Product List page

HariP

Hi Hoonius

If i do that, the images are displayed in the product list page but the image is not getting displayed in the Product details page.

There, the image path is rendered like http://localhost/StarterSite/~/images/sleepingbags03.gif

Thank you,
Regards,
Hari





Re: Commerce Server 2007 Problem in dispalying images in Product List page

Hoonius

does the same thing happen with

CommerceComponents.Common.ComponentCommon.ConvertApplicationUrl(imagefilepath)




Re: Commerce Server 2007 Problem in dispalying images in Product List page

HariP

Thanks Hoonius,

It worked.

I gave the image path as ~/images/<filename> in the Catalog manager and modified the code in the ControlLibraray-> ProductDetails.cs as CommerceComponents.Common.ComponentCommon.ConvertApplicationUrl(imageSource) for image source.