473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Display Image

Hi all,

Im working with Datagrid for image manipulation.I have an image upload part which work as uploading an image in Server Map Path and storing the image path in database .I displays the image name in datagrid. The thing i want is, hw can i display the image in a placeholder wen i click that link in Datagrid?

Can anyone suggest an idea.?Is there any other option?Whether this concept works?

And also is it possible to return a value from a set of code to another set?Pls give me its format.Im really a new to .net.

Thanks
Jan 21 '08 #1
2 1406
kunal pawar
297 100+
If your Image is store in data base then u can show image in image tag with assigning navigationrl/src = .aspx whose content type is image

this is code for .aspx page

<%@ Page Language="vb" AutoEventWireup="false" %>
<%@import Namespace=System.IO %>
<%@Import namespace=System.Data.SqlClient %>
<%@Import namespace= System.Threading %>
<%@Import namespace= System %>
<%@Import namespace= System.Data %>
<%@Import namespace= System.Web %>
<%@ Import Namespace="System.Drawing" %>
<%@Import namespace= System.Drawing.Bitmap %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@Import namespace= System.Web.UI.WebControls.Image %>
<script runat="server">
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader

</script>
<%

con = New SqlConnection(ConfigurationManager.ConnectionStrin gs("desktopConnectionString").ConnectionString.ToS tring())
con.Open()
Dim ret_img As String
ret_img = "SELECT B.TITLE, B.IMAGEPATH FROM SESSION where IMAGE_ID='" + Request.QueryString("imageid") + "' "

cmd = New SqlCommand(ret_img, con)
dr = cmd.ExecuteReader
Dim imagedata As Byte()
Dim bmp As Bitmap
If dr.HasRows Then
dr.Read()
imagedata = dr.Item(0)
If imagedata.Length > 0 Then
Dim srm As MemoryStream = New MemoryStream(imagedata, True)
srm.Write(imagedata, 0, imagedata.Length)

Try

bmp = Bitmap.FromStream(srm)
Dim g As Graphics = Graphics.FromImage(bmp)

Response.ContentType = "image/JPEG"
bmp.Save(Response.OutputStream, ImageFormat.Jpeg)

Catch ex As Exception
' Response.Write(ex.Message)
End Try

End If
End If
%>
Jan 21 '08 #2
Hi,
Thanks for the response,
But i didnt stored the image in database, i only stored the image name(filename) in databse.Image is in Sever.MapPath.
Now the situation is that i displayed the filename in datagrid, wen i click that filename it should display the image in a placeholder.
Any solution for that?

Thank U.
Jan 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
4
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
3
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
3
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr +...
0
by: adubra | last post by:
Hi there, I am using a device context (DC) and a buffer to successfully draw to screen. However, when I update the DC at very high frame rate and drag the frame containing the image very quickly...
1
by: nanaalwi | last post by:
Hi, Currently I'm developing a software using VB.net that can grab an image using Matrox Morphis card and display it in a PictureBox. The software can grab the image already and display it in the...
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.