Page 1 of 1

Simple Category List Images

Posted: Mon Dec 15, 2008 9:09 am
by Cornerstone
Is there a way to have images instead of text links for the categories?

I attempted this making all the image the same as the text of the "Name" of the category...

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl="images/<%#Eval("Name")%>.jpg" NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

instead of this...

<asp:HyperLink ID="CategoryLink" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#Eval("NavigateUrl")%>'></asp:HyperLink>

and this will not work. I get an error. I don't know ASP.Net very well and would appriciate any help. Thanks!

Derek

Re: Simple Category List Images

Posted: Mon Dec 15, 2008 9:19 am
by mazhar
It sounds like a path problem. You have to provide more information for image location like

Code: Select all

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl="App_Themes/YourTheme/images/<%#Eval("Name")%>.jpg" NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

Re: Simple Category List Images

Posted: Mon Dec 15, 2008 9:24 am
by Cornerstone
Got the same error...

[[ConLib:SimpleCategoryList]] The server tag is not well formed.

Re: Simple Category List Images

Posted: Mon Dec 15, 2008 9:36 am
by mazhar
Use this code

Code: Select all

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl='App_Themes/YourTheme/images/<%#Eval("Name")%>.jpg' NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

Re: Simple Category List Images

Posted: Mon Dec 15, 2008 9:48 am
by Cornerstone
That code did put image place holders in, but the pathing was wrong and the links were wrong.

Example is...

Image url = http://www.site.com/ConLib/App_Themes/T ... %25%3E.jpg

Link url = http://www.site.com/ConLib/%22%3C%25#Ev ... Url%22)%25

Any ideas?

Thanks again.

Re: Simple Category List Images

Posted: Tue Dec 16, 2008 7:41 am
by mazhar
Here is the modified version of SimpleCategoryList control, check this out.

Re: Simple Category List Images

Posted: Tue Dec 16, 2008 7:47 am
by mazhar
One thing more you need to update the following line in the code file so that it picks the image from your current template.

Code: Select all

string imagePath = "~/App_Themes/AbleCommerce/images/" + name + ".jpg";
For this you will have to change Ablecommerce to your custom store theme name if you are using some other store theme. It would be something like

Code: Select all

string imagePath = "~/App_Themes/YourStoreThemeName/images/" + name + ".jpg";
Just replace your YourStoreThemeName with actual name of your store current theme.

Re: Simple Category List Images

Posted: Tue Dec 16, 2008 8:17 am
by Cornerstone
Thanks so much! It worked perfectly. I really appriciate you helping me in figuring this out.