473,503 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image on a datagrid

Tom
Hey all,
have a dategrd and am storing a url to an image in it. I
have no idea how to show the actual image. Can anyone give
me a hand or point me towards an example they know of. I
have searched the web and haven't found anything that is
of much use. Cheers and have a good one,
Tom
Jul 19 '05 #1
1 2598
tom
figured it out myself if anyone is interested:

Private Sub dgName_ItemDataBound(ByVal sender As
Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgName.ItemDataBound
'will be used to set the value of the image in the
datagrid
Dim imgTest As New System.Web.UI.WebControls.Image
()

If e.Item.ItemType = ListItemType.Item _
Or e.Item.ItemType = ListItemType.AlternatingItem
Then
'we have hard coded the text "No image
available" earlier on. And look for it here.
'if that is the text then out put it, if not,
out put the picture
imgTest.ImageUrl = e.Item.Cells(5).Text
If imgTest.ImageUrl = "No image available" Then
e.Item.Cells(5).Text() = imgTest.ImageUrl
Else
e.Item.Cells(5).Controls.Add(imgTest)
End If
End If
End Sub

thanks anyway,
tom
-----Original Message-----
Hey all,
have a dategrd and am storing a url to an image in it. I
have no idea how to show the actual image. Can anyone giveme a hand or point me towards an example they know of. I
have searched the web and haven't found anything that is
of much use. Cheers and have a good one,
Tom
.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3040
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
1
2239
by: Jim Hammond | last post by:
The code below implements two datagrid columns that display images. The first column is just a test that always displays the same image directly from a file. The second column pulls the image from...
1
2491
by: John Thompson | last post by:
We're sooo close. When we load the page to upload the image, all of the prms go through except the binary image data. Using SQL server with the data type set to "image". Please help! Thanks-...
4
1437
by: nicholas | last post by:
How can I show or hide an image in a datagrid depending on a field. Something like: if myfield <> "" then 'show image' else 'show noimage.gif' end if the image field contains the image name...
2
1821
by: SQL_Klovn | last post by:
Hi! I have been struggeling for quite some time now with a stupid problem which drives me crazy. I have Datagrid, where I load some images from a SQL2000 database. This works fine, but I am not...
13
2333
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't...
1
2206
by: ltt19 | last post by:
Hi everyone! I want to do da Image gallery using just the datagrid, this one will dilpays only images, no text, that means that it will have about 4 Collumns that will displays just images from...
0
1220
by: Tim::.. | last post by:
Please, please, please help!!! I have a datagrid that displays a list of contacts on our intranet site using the ActiveDirectory as it's main Data Source. I want to be able to show an image of...
1
2259
by: Michael Turner | last post by:
Anyone know if you can add a background image to a datagrid, there is a property for colour but not for an image.
0
1396
by: rockdale | last post by:
Hi, All: I dynamic add an arrow up/down image in OnItemDataBound event for my datagrid, it works fine. But I have another textbox which trigger postback and doing something, after this event get...
0
7091
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
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6998
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
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.