I would like to add an image to the Category listing on the home page. So instead of just the text, there would be a pic of the category itself. My code is VB.
I would like to add an image to the Category listing on the home page. So instead of just the text, there would be a pic of the category itself. My code is VB.
hey tim
Try this code hope it works for you too.
Set an html img tag to your control where you want to display image As i had this requirement in a datalist. so its like this for image display in Design view of page
And for code behind i had created a method named bind_image
Public Function bind_image(var As Boolean) As String
Dim path As String = ""
If var = True Then
path = "../Images/Active.png"
Return path
Else
path = "../Images/Inactive.png"
Return path
End If
End Function
Hope it works for you and let me know if you have nay other issues too.
iamsaltman
Member
24 Points
43 Posts
Add image to Category listing
Nov 04, 2011 02:35 AM|LINK
I would like to add an image to the Category listing on the home page. So instead of just the text, there would be a pic of the category itself. My code is VB.
Any help would be greatly appreciated.
Thanks,
Tim
mayankpathak...
Contributor
3643 Points
844 Posts
Re: Add image to Category listing
Nov 04, 2011 04:17 AM|LINK
hey tim
Try this code hope it works for you too.
Set an html img tag to your control where you want to display image As i had this requirement in a datalist. so its like this for image display in Design view of page
<img src='<%# bind_image(Convert.ToBoolean(Eval("IsActive")))%>' alt="is active"/>And for code behind i had created a method named bind_image
Hope it works for you and let me know if you have nay other issues too.
iamsaltman
Member
24 Points
43 Posts
Re: Add image to Category listing
Nov 05, 2011 08:32 PM|LINK
Thank you for the help. However, I am getting the following error now -
DataBinding: 'AspNet.StarterKits.Classifieds.Web.CachedCategory' does not
contain a property with the name 'IsActive'.
Thanks,
Tim