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
110
Conditional Image in Wingrid Cell
posted

Hi there,

I'm looking for some advise on getting an image into my wingrid cell correctly. I have tried a few different things with some strange results, most likely I'm missing the point somewhere along the lines...

OK I have a grid (always a good start), a column called priority (with values like high, medium, low etc). When the grid row is initialised I find the priority cell's value. If the cell is high I want to replace the text in the cell from the word "high" to an exclaimation mark image (16x16 png).

So...

public void gridTasks_InitializeRow( sender,... e )

string myValue = ( string )e.Row.Cells["Priority"].Value;

if ( myValue.ToLower() == "high" )

{
e.Row.Band.Columns["Priority"].CellAppearance.Image = Icons.exclaimation_red;
//e.Row.Band.Columns["Priority"].CellAppearance.ImageBackground = Icons.exclaimation_red;

e.Row.Band.Columns["Priority"].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay;
//e.Row.Band.Columns["Priority"].CellButtonAppearance.Image = Icons.exclaimation_red;

e.Row.Cells["Priority"].Value = "";
}

What's really strange is I can step through the debugger and see myValue is "high", every 3rd or 4th row but every row comes back with the priority column cell with the image in it. I don't think this is the best way of applying the image to a cell so is there a better way?

Can I use a Layout appearance e.g.

// e.Row.Cells["ImpactId"].Appearance = grid.DisplayLayout.Appearances["Positive"];

Cheers,
John


Parents Reply Children
No Data