Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
Retrieving images from row and cells
posted

I am exploring various ways of setting images to a row and cell in a row in winultra grid.

I have a grid with bound columns .  The values will be verified dynamically and if any cell/ Row is found to have errors, an error image should be displayed in row/cell appropriately.

Following is the approach I follow

1.        In the grid_InitializeLayout, I set the following properties for e.Layout.Override(o)

a.       o.DataErrorRowSelectorAppearance.Image = <error Image>

b.      o.DataErrorRowAppearance.BackColor = System.Drawing.Color.LightYellow;

c.  o.DataErrorCellAppearance.Image = <error Image>

d.      o.DataErrorCellAppearance.ImageHAlign = HAlign.Left;

e.      o.DataErrorCellAppearance.BackColor = System.Drawing.Color.LightYellow;

2.       In grid_aftercellupdate, I am verifying the value of the cell and based on the validations, if I find an error, I am calling the following statement to mark an error

a.       ((DataRowView)cell.Row.ListObject).Row.SetColumnError(cell.Column.Key, msg)

This shows the image in the required cell. As the image is displayed only in the cell having errors, I suppose that some appearance properties in the cell should contain the image that was  being displayed. I have verified the following properties of the cell in the row

I.       ActiveAppearance.Image

II.     Appearance.Image

III.    SelectedAppearance.Image

But all of them are null even though the cell displays the image.  Can you let me know from which properties of the cell, I can retrieve the image displayed. I am sure that some property of the cell will contain the image as it will be shown only for the cells with errors.  Similarly, can you let me know how to retrieve the image from the row when there is an error.