We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Image column from DataSource mapping

Thread ID:

Created:

Updated:

Platform:

Replies:

132638 Sep 13,2017 02:21 PM UTC Sep 14,2017 06:12 AM UTC WinForms 1
loading
Tags: GridGroupingControl
Alessandro Losi
Asked On September 13, 2017 02:21 PM UTC

Hi, I have a problem with the GGC that I can't figure out. I have to display Users in my GGC with a column image representing the Profile Picture.
  • How can I map the Image Column to the datasource field that contains the image data?
  • Which data type should the field use? Byte array, Bitmap, Image...

The column is already set with Apperance.AnyRecordFieldCell.CellType = Image.

Thanks


Arulpriya Ramalingam [Syncfusion]
Replied On September 14, 2017 06:12 AM UTC

Hi Alessandro,   
   
Thanks for using Syncfusion products.   
   
Suggestion 1   
   
We could understand your scenario. In order to populate the images from the datasource, the corresponding column type can be set as Byte[] array in DataSource. The images will be loaded into the grid by its corresponding byte values. Please make use of below code and sample,   
   
Code example:   
   
   
//To add the image column into DataTable   
dataTable.Columns.Add("Image"typeof(byte[]));   
   
//To add the image for the ImageColumn   
Byte[] imageArray = System.IO.File.ReadAllBytes(FindFile(@"flower" + i % 3 + ".jpg"));   
dataRow[3] = imageArray;   
   
//To set the datasource   
this.gridGroupingControl1.DataSource = dataTable;   
   
   
   
Suggestion 2   
   
In order to load the image for an Image CellType column, the following ways can also be used,   
  • QueryCellStyleInfo event.
  • Using Appearance property.
  
Please refer to the below KB link.   
   
Regards,   
Arulpriya   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;