ASP.Net Datagrid and thumbnails
-
I need to fill a datagrid with data and images. There will be some data in about 4 columns and then 1 thumbnail in one column on each row. I am reading a MS SQL DB that has the description, mfg, owner and path/name to the jpg image for that item. What I need to do is convert the images to thumbnails, store them in a dataset along with the other data that will be displayed in the datagrid and then bind the DS to a datagrid. Does anyone know if this can be done. If so, can you either tell me how to do it or direct me to some info that will help me. If it can't be done this way, does anyone know how it can be done and would you share that with me.
-
I need to fill a datagrid with data and images. There will be some data in about 4 columns and then 1 thumbnail in one column on each row. I am reading a MS SQL DB that has the description, mfg, owner and path/name to the jpg image for that item. What I need to do is convert the images to thumbnails, store them in a dataset along with the other data that will be displayed in the datagrid and then bind the DS to a datagrid. Does anyone know if this can be done. If so, can you either tell me how to do it or direct me to some info that will help me. If it can't be done this way, does anyone know how it can be done and would you share that with me.
Hi there, You can get the thumbnail of an image using the Image.GetThumbnailImage Method[^]. However, you don't need to create and add the thumbnail to a dataset and you can deplay it until the data is bound to the datagrid control. In an ASP.NET application, you basically use an image control to display the image, and you either set the path of the static image in the image control or use a seperate web page .aspx that is responsible for generating the image/thumbnail on the fly. So in this case, you may have two options here: + Create and save the thumbnails to disk, you only need to store of the paths of the thumbnails in the dataset, then bind it to the grid. + You only store the path of the image files, not the thumbnail, in the dataset, and use a seperate web page (or a custom http handler) to generate the thumbnails on the fly. I believe that many people asked this question in the forum, so you can search for it or you might also want to check out the site[^] for tons of the datagrid examples