Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 Issue: Images Retrieve from DB to Details view
Posted by Shanu_Sudha on  1/30/2010 1:31:59 AM Category: C#
Add to my favorites
Email to friend
Dear All,

I've two tables 1. Product Details 2. Image details
I joined this two tables with ID,

It shows the Product details with corresponding images...

Exampl... 1, Product Name, Product Price, Product Image (This from Image Details table)

Now I've bind all the data into the Details view..
I can get all the data without image....

I need to show the images for the corresponding products....

How do i perform this..? I don't know How to proceed...

Can anyone help me...??

Post Your Reply Post New Question

 Viewer's Reply
Display Images in DetailsView control
Answered By Moderator1 on 1/30/2010 9:09:11 PM

Place a Image control inside the DetailsView control, then bind the ImageUrl property with the ImageUrl you stored in the Image Details table. The query to return the product details should be joined with the Image details table as follows,

Select * from productdetails pro inner join imagedetails img on where"Pass your Product Id here."
Answered By Shanu_Sudha on 2/1/2010 11:44:29 PM
Hi.. First, Thank You..

I've already done this way which u have mentioned..

Sample :

<asp:image id="myimage" runat="server"
imageurl='<%# Eval("img_Name", "path/to/image/{0}") %>' />


Select * from Store_Products SP inner join Image img on SP.Prod_ID=img_ProdID where SP.Prod_ID=1

But I can't get the image...
Make sure your ImageUrl is correct
Answered By Moderator1 on 2/4/2010 9:59:39 PM

I checked your ImageUrl value. The syntax is correct, but make sure your image path "path/to.." is correct. My sample code is below,

<asp:Image ID="Image1" runat="server" Height="100px" ImageUrl='<%# Eval("ImgPath", "Images/{0}") %>' Width="100px" />
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
Sexy Web Design - Free 71 Page Preview!
Take Advantage of Oracle's 2 Day DBA Course