Mr A
Mr A

Reputation: 6768

Web control / jQuery function for displaying images from database?

I want to create a product sales page that displays a product images (with their prices and names) generated from SQL Server database. When a user clicks on a specific image, it should navigate to another page with more images and details of that particular product. I don't know which control to use to display images on the sales page.

Also, the admin can add products with images - therefore when they add a new product, that product should come the first on the sale page. I can achieve this by writing a simple query, but I don't know what I should use to display the images. I can't use image buttons (because the images can be more than 50 depends) nor can I use GridView. If this can be achieved through jQuery, any help or assistance would be highly appreciated.

I am using ASP.NET and SQL Server 2008.

Upvotes: 1

Views: 911

Answers (1)

John Bledsoe
John Bledsoe

Reputation: 17642

Since you want to show your images in HTML pages, you're going to need to use the IMG tag, plain and simple. (I'm sure there are other ways to display images in HTML, but IMG is the most straightforward.) The real question you need to answer is how do I create URLs for each of the images stored in my database?

You're likely going to need to create an HTTP handler that parses each image request URL, retrieves the image from the database and sends the image bits to the response stream. You could also include features like caching the image on the file system to make the handler perform better.

Hope that sends you in the right direction!

Upvotes: 1

Related Questions