Hi
I'm sure this is simple but I can't find an answer to this.
I have created an UltraDataSource and am dynamically adding strings to cells, and need to add an image.
I've set the column style as follows:
e.Layout.Bands[0].Columns[columnKey].Style = ColumnStyle.Image
Then, for good measure set the DataType:
e.Layout.Bands[0].Columns[columnName].DataType =
typeof (System.Drawing.Image); // have also tried System.Drawing.Bitmap
But when I come to assign the image to the equivalent cell in UltraDataSource
rows[x][y] = imageObject; // type Image
It errors with "Object must implement IConvertible."
Please help!
Hi,
All of the code you posted here is operating on the grid column - it has nothing to do with the UltraDataSource.
If your UltraDataSource column is a string, then you cannot store images in it. In order to store an Image, the UltraDataSource column has to be a type that can hold an image, such as Image or Bitmap.If you use one of those types for the column in the UltraDataSource, then you don't need to do anything to the grid column. The grid will detect the type and show the image.
All of this is assuming that you want a cell that just displays an image and nothing else. If you want a cell that has text in it and also has an image or an ImageBackground, then you would do that by using a string column like you are doing and then apply an image to the cell via the cell's Appearance.