473,396 Members | 1,998 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,396 software developers and data experts.

Using GridView event to display image in GridView in IMAGE control

Hi All,

1. My colleague and Me have created a small vb.net application, we are storing some data & images using this application. The destination path for this images is the "vb.net application startup path" + the Image folder, which we created in the application folder.

The file path will be like "C:\Documents and Settings\suresh\Desktop\RegIR_NEW\RegIR\bin\Debug\ ..\..\Images\8-Q-IMG.jpg".

where "C:\Documents and Settings\suresh\Desktop\RegIR_NEW\RegIR\bin\Debug" is the "vb.net application startup path" and "\..\..\Images\8-Q-IMG.jpg" is the image folder name and the image name.

The image is stored in "Images folder" and the file path will be stored in Database.

2. I need to create an asp.net web application where I can retrieve the data from the database. on the click of a button I can able to retrieve the table from databse in Gridview.

What I want now is on the click of "SELECT Event or by any other event in gridview", I must get the corresponding image in that row in "Image Control"

Since in Gridview the image is in filepath I do not know how to display the image.

Can any one please please help on this?. If you have any doubt please let me know.

NOTE: I have uploaded the gridview screen shot.
Attached Images
File Type: jpg Gridview.jpg (15.3 KB, 263 views)
Dec 2 '13 #1
3 2609
Frinavale
9,735 Expert Mod 8TB
I am not sure what you are having problems with.

You created a VB.NET application (of unknown type) that copies or moves image files into the application's startup-path/images folder and you are recording the path to this image into a database.

This application doesn't seem to be causing you any problems but I have no idea what type of application this is or where this application is running.

Now you want to make a new ASP.NET application and you seem to be having problems with it...

Is your problem that:
  1. You don't know how to handle an event raised by a button in a GridView?
  2. You don't know how to display the images in the web browser?
    • Before we can help you with this we need to know: Is this application run on a computer that is NOT the web server?

-Frinny
Dec 2 '13 #2
Hi Frinny,

Thanks for your reply.
I am using both of these application on remote server, by using "MSTSC". My main doubt is

1.whether I can get the image from gridview in a "Image" control, by using this kind of file path

"C:\Documents and Settings\suresh\Desktop\RegIR_NEW\RegIR\bin\Debug\ ..\..\Images\8-Q-IMG.jpg".

The above file path is in the vb.net application

2.If not can you please specify other method also by which I can get the image by using this filepath.

I am new to asp.net. And your help will be great to me.

Thanks in Advance.
Dec 5 '13 #3
Frinavale
9,735 Expert Mod 8TB
In your image that you posted, there is no "image control" being used. You have a column displaying text...which so happens to be a path that is stored in your database.

If your "desktop" application (I'm assuming it's a desktop application) stores, into the database, a path to the image on the computer that it is running on...and that application is run on a computer that is not the web-server... than how do you expect the web-server-code to ever get the image?

If the image does not exist on the web server, you cannot retrieve it in your asp.net code.

If the image does exist on the web server but in a place that is not accessible to the web browser, the image will not be displayed.

You cannot access the client's computer from server-side code. Likewise, you cannot access the client's computer files from JavaScript because of security concerns.

Let's pretend it's a perfect world and the image exists at the path in the database on the web server.

You should implement a method the GridView's OnSelectedIndexChanged Method.

In that method you should be able to retrieve the row that is selected, and then use the FindControl method on the row to retrieve the control that is displaying the path to the image.


-Frinny
Dec 9 '13 #4

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

Similar topics

1
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail...
3
by: jim.murphy | last post by:
I am not sure If I can do this with a lookup, but what I would like to do is perhaps use lookup to retrieve a control date from an unassociated table to control what date is entered in another...
0
by: msch-prv | last post by:
I have a gridview with an icon. Clicking on the icon via the OnCommand event causes a pop up form to appear. This however generates an 'Invalid postback or callback argument' at run time. To...
1
by: shapper | last post by:
Hello, I created an Hyperlink field in a GridView but I can't find and ImageUrl property. I know normal Asp:Hyperlink control can also be used with an Image. Is this possible in GridView? ...
2
by: rams083 | last post by:
how can i display an image on Image Control from Database, asp.net 2.0 vb? please help me... thank you for your reply...
0
by: manjitsarma | last post by:
I need to display an image in 'Image Control' of aspx page.Now the image is displayed in the aspx page itself.But I need to display it in 'Image Control'.This is a map application and the image is...
1
by: rh1200la | last post by:
Hey all. I'm trying to display a BLOB image from SQL Server to a .NET user control. I have found resources on the internet that say create a .aspx page and display at as content type image/gif. ...
5
by: faizalahmd | last post by:
How to display image in image control , which is retrieved from the data base . using c# in asp.net regards, FAIZAL AHMED.H
1
by: sakura | last post by:
Hi. I'm using asp.net and c# language. How can i display a GridView using select statement of two column in one table? This is my coding: if (sdr.Read()) { if(namaPembekal.Equals(sdr)...
0
by: anakramli | last post by:
Salam, first of all i would like to say hi all.This is my first time posting question over here. Basically im trying to make a simple product list to be display over our web project development...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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.