Convert to Image

3 posts, 0 answers
  1. Mohsen
    Mohsen avatar
    1 posts
    Member since:
    Mar 2014

    Posted 15 Mar 2014 Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 19 Mar 2014 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Arron
    Arron avatar
    22 posts
    Member since:
    Apr 2013

    Posted 17 Apr 2014 in reply to Mohsen Link to this post

    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
Back to Top