This is a migrated thread and some comments may be shown as answers.

GridView ImageColumn not showing image

5 Answers 665 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Leandro
Top achievements
Rank 1
Leandro asked on 14 Oct 2014, 10:10 AM
Hi,

I've already performed a search here, and I think I'm doing this right, but the fact is that my RadGridView does not show the image.
The only thing that the field shows is "System.Drawing.Bitmap"

'Loading image from file ( path in database )
     Dim img As Image = Image.FromFile(Reader("Imagem"))
 
'Attempt 1
     r.Cells(2).Value = img
 
'Attempt 2
'Writing to a memory stream
     Dim ms As New MemoryStream
     img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
'passing the bytes to the value field
     r.Cells(2).Value = ms.ToArray
 
'Attempt 3
'Simply loading an image from resources to the value field
     r.Cells(2).Value = My.Resources.icon_fantasma_05


I know I'm doing something wrong, I just don't know what. These 3 attempts , are based / copy from examples given on the intermet..
I've attached a image, which shows what I'm getting at the GridView.

Could somebody please help?

Thank you very much !

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Oct 2014, 07:59 AM
Hello Leonardo,

Thank you for writing.

Most likely, the column you are assigning the image to is not of type GridViewImageColumn. Can you please double check that?

More information on this type of column is available here: http://www.telerik.com/help/winforms/gridview-columns-gridviewimagecolumn.html.

I am looking forward to your reply.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Leandro
Top achievements
Rank 1
answered on 15 Oct 2014, 09:24 AM
Hi,
Thank you for taking time to awnser the question.
Yes, I have checked and, in the columns list, column number 3, (index 2), is a GridViewImageColumn.

In the picture below, you can see.

Thank you
0
Stefan
Telerik team
answered on 15 Oct 2014, 10:03 AM
Hello Leonardo,

If the column type is correct, perhaps the image is not. Can you try to save it to a file and make sure it is correct?

Attached you can find a small video demonstrating how all of the three approaches you mentioned are working correctly on my en. The video opens in browser and requires shockwave flash player.

If you still experience issues, please submit a support ticket and in it, attach a sample project, where the issue can be reproduced, so we can investigate the precise case and help you with it.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Leandro
Top achievements
Rank 1
answered on 15 Oct 2014, 10:33 AM
Hi,

I've done it the way you have, and it works.. (adding a column by code and assigning the value to it...)
But, in a column created by the designer, with the same type, I cannot get it to work!

Here is a video ( uploaded to MEGA, it's a swf created with the same software you used) : http://goo.gl/S6xPGH

Thank you!
0
Stefan
Telerik team
answered on 16 Oct 2014, 06:00 PM
Hi Leandro,

I have tested with a column added at design time and once again I am able to add image with the code provided. Attached you can find a sample project demonstrating this.

A possible reason for such behavior might be if you have changed the default DataType of the GridViewImageColumn, to something different than System.Drawing.Image. Can you please check this?

If you still experience this issue afterwards, in order to speed up the process of resolving this case of yours, please get back to me with a sample project, where this issue can be replicated and I will look into it. You can use the project I provided and just modify it to replicate the case.

I have converted this forum thread into a support ticket in order to allow attachments. You can find it in your Account.

I am looking forward to your reply.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 

 
Tags
GridView
Asked by
Leandro
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Leandro
Top achievements
Rank 1
Share this question
or