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

Convert to Image

2 Answers 8 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Mohsen
Top achievements
Rank 1
Mohsen asked on 15 Mar 2014, 09:02 PM
Why doesn't the following code work?

imageContainer1.Image = ((GridViewCellInfoCollection)multiColumnComboBoxPhysicans.SelectedItem)["Image"];

I'm getting the following error:

Cannot implicitly convert type 'Telerik.WinControls.UI.GridViewCellInfo' to 'System.Drawing.Image'.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 19 Mar 2014, 02:23 PM
Hello Mohsen,

Thank you for writing.

The SelectedItem property gives you access to currently selected row of the underlying grid. You can cast it to the appropriate type and access the value of the cell that contains the image:
GridViewDataRowInfo row = radMultiColumnComboBox1.SelectedItem as GridViewDataRowInfo;
Image img = (Image)row.Cells["image"].Value;

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Arron
Top achievements
Rank 1
answered on 17 Apr 2014, 07:05 AM
Hi, Mohsen.
Have you ever tried the code offered by Dimitar?
GridViewDataRowInfo row = radMultiColumnComboBox1.SelectedItem as GridViewDataRowInfo;
Image img = (Image)row.Cells["image"].Value;
Did it work well? Or you can google it and select some manual image converters which can be customized by users according to our own favors to help you convert images. Remember to check its free trial package first if possible. I hope you success. Good luck.



Best regards,
Arron
Tags
MultiColumn ComboBox
Asked by
Mohsen
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Arron
Top achievements
Rank 1
Share this question
or