-1

I have made a Movie rental system, in which the user logs in, i want to show him the top 3 rented movies and that to in the form of images. so how can i bind multiple images from the database.

I'm using asp.net 4.0 and entity framework for connecting to the sql server 2008R2 for storage.

I'm a beginner in this technology, so bear with me.

Thanks

Sandeep
  • 278
  • 1
  • 6
  • 21
  • You need to use a data control like GridView, ListView, Repeater, and load a collection of images and bind it to the control. Search for asp.net data binding. – Amiram Korach Sep 27 '12 at 01:19

1 Answers1

0

I am guessing that you use a Gridview or Repeater control to show the list.

If it is GridView, you can use TemplateColumn and Add a ImageControl, use a ImageHandler to get the images from the database.

How to create a handler:

public class SignatureHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        int recordid = Convert.ToInt32(context.Request.QueryString["recordId"]);
        Movie movie = GetMovie(recordid);
        context.Response.ContentType = movie.ImageFileType;
        context.Response.BinaryWrite(movie.ImageFile.ToArray());

    }        

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}
Manoj De Mel
  • 927
  • 9
  • 16