• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • Last Modified:

show image in asp.net vs 2010.. gridview vb.net

hi i want to use a gridview(asp.net) and show the pictures in the gridview

im showing the data of table (Sql 2005) manufactures which has (col names:Name, deleted, PicturedID:(Int),etc)

and images are stored in picture table  column consists of (PictureID,PictureBinar-varbinary(max))
Manufacture(Pictureid and Picture table(Pictureid) is both key which can be joined..

So i need to show the data in the gridview with Picture(Image contrl), fetching from the manfuture table

appreciated.. if any code is there.. should have good peformance..
0
bsarahim
Asked:
bsarahim
  • 2
1 Solution
 
Alfredo Luis Torres SerranoDevelopment Director / DBACommented:
0
 
bsarahimAuthor Commented:
the image are stored in the database.. not the file url method
0
 
Alfredo Luis Torres SerranoDevelopment Director / DBACommented:
Simply

Dim arrayImage() As Byte = CType(YourPictureField, Byte())
Dim ms As New MemoryStream(arrayImage)
With Containerofpicture ' Example Me.PictureBox1
      .Image = Image.FromStream(ms)
      .SizeMode = PictureBoxSizeMode.CenterImage
End With

Hope this help
0
 
CodeCruiserCommented:
One option is to add a page to your site which takes a pictureID in query string and returns the picture. Then you can use that URL in the src of your image columns.

Example

http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspx


Using HTTPHanlder approach

http://csharpdotnetfreak.blogspot.com/2009/07/display-images-gridview-from-database.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now