How to display image and hyperlink in a DataList control?

Hello - I've got to work up a page in ASP.NET 2.0 that displays logo images (about a dozen; 3 columns by 4 rows) with corresponding hyperlinks to the company websites

I've got these image file names and company website links in a user-maintained table (in a MS Access database), and I've set up a DataList control (with RepeatColumns="3") that pulls those two fields  

I don't see a particular control that displays an image with a hyperlink; is there one?

If there isn't one, then how do you set the "NavigateUrl" property of the HyperLink control from a field in the data source? "NavigateUrl="<%# Eval("CompanyURL") %>" doesn't work like I thought.

Thanks

Mark
mlagrangeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nauman_ahmedCommented:
Just add a template column like the following:

<asp:DataList ID="DataList1" runat="server">
            <ItemTemplate>
                <a href='MyPage.aspx?ID<%#DataBinder.Eval(Container.DataItem,"ID_COLUMN")%>'><img src="image1.jpg" border=0></a>
            </ItemTemplate>
        </asp:DataList>

-Nauman.
0
mlagrangeAuthor Commented:
Thanks nauman, that's half of it; the logo for each company needs to display along with their link.

How do I pull the file name into the <img src? I would think this would work:

     <img src='<%#Eval("CompanyLogo", "~/Images/{0}")%>' border=0>

but all I get are red x's

("CompanyLogo" is a field in the data source that holds the file name of the logo, and the logo's are in a folder called "Images")

Thanks again

Mark
0
nauman_ahmedCommented:
<img border=0 src='~images/<%#DataBinder.Eval(Container.DataItem,"CompanyLogo")%>'>

-Nauman.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlagrangeAuthor Commented:
For some reason, "'~images/" didn't work; it wouldn't work until I put the full path in there

No matter; I've got a demo shortly, so I'm happy

Thanks, Nauman.
0
nauman_ahmedCommented:
Mark, Glad I was able to help :)

-Nauman.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.