How to display Image in grid view ?
-
Dear all, I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview? In my case,the grid view will show name and description then the last field will be the image. Any opinion or suggestion are welcom. regards cocoonwls
-
Dear all, I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview? In my case,the grid view will show name and description then the last field will be the image. Any opinion or suggestion are welcom. regards cocoonwls
-
Hi, you can Add in your grid a image field. then this imagefield have properties to call the image from your database. like: DataImageUrlField = dr("image").tostring(); Hope this one Can Help Thanks
-
Hi sayrecollado, thanks for your quick reply. But may i know where to add the DataImageUrlFiled? regards cocoonwls
Add the tag in the Gridview like this.
<asp:GridView> <Columns> <asp:imagefield dataimageurlfield='<%# DataBinder.Eval(Container.DataItem, "imagepath") %>'/> </columns> </asp:GridView>
Where imagepath is the Column of the Dataset having image path. This will automatically display the image when you will bind the dataset to gridview. Regards, Kaushal Arora -
Dear all, I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview? In my case,the grid view will show name and description then the last field will be the image. Any opinion or suggestion are welcom. regards cocoonwls
-
Add the tag in the Gridview like this.
<asp:GridView> <Columns> <asp:imagefield dataimageurlfield='<%# DataBinder.Eval(Container.DataItem, "imagepath") %>'/> </columns> </asp:GridView>
Where imagepath is the Column of the Dataset having image path. This will automatically display the image when you will bind the dataset to gridview. Regards, Kaushal Arora -
Dear all, I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview? In my case,the grid view will show name and description then the last field will be the image. Any opinion or suggestion are welcom. regards cocoonwls
cocoonwls wrote:
I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview?
Yes! Displaying Image in Gridview from Database
cheers, Abhijit CodeProject MVP
-
cocoonwls wrote:
I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview?
Yes! Displaying Image in Gridview from Database
cheers, Abhijit CodeProject MVP
Hi Abhijit, That is a great article for a newbie in asp.net like me. But my image are located in C:\myFolder, so how can i display it from there? the path which i store in database is "C:\myFolder\img.gif". I saw in your article you always have the symbol "~", could you tell me why is like that? thanks in advance, and thanks for those reply me question~ regards cocoonwls