I have a databound datagridview, with a colum of type DataGridViewImageColumn.
I want to show an image based on cell value.
I’m using DGV_CellFormatting event to assign a System.Drawing.Image as cell.Value, but nothing happens.
If I assing the same image resource to a button it shows up.
Could you please check my sampe code and help me figure out what’s wrong?
Thank you very much,
See attached modified sample. There are a couple of issues:
In the attached modified sample I have included a DGVColumn override that is a temporary fix for WJ-8322. I also modified the sample to return the image path instead of the actual bitmap in CellFormatting. Using the bitmap in CellFormatting instead of a string is logged as an enhancement WJ-8323.
Using the image path is preferable on the web since it gives the browser a chance to cache the image and reduces the data transferred to the client. You may also make the images embedded resources instead of deploying them and prefix the image name with “resource.wx” -> “resource.wx/image.png” or the resource path “resource.wx/Resources.Images.image-name.png”, or the full assembly “resource.wx/MyAssembly.Resources.Images.image-name.png”.
In alternative you can assign the Bitmap to the cell value.
Both WJ-8322 and WJ-8323 should be completed soon.
Please login first to submit.