I have a grid that has 2 image columns - one for an edit icon and one for Delete. I need separate icons to so they show properly when the row is highlighted and when it is not. I'm adding the icons as shown below. Each row will get these icons. However, if the value in the Relation column is set to Maker then there should be no Delete icon and the Delete event should not fire.
When I set e.Row.Cells["Delete"].Value = null;, nothing happens. The Delete icon remains. What am I missing here?
void gvRelatedPhoneNumbers_CellFormatting(object sender, CellFormattingEventArgs e){
if (e.CellElement is GridDataCellElement)
{
if (e.Column.Name == "Propertys") // Edit
e.CellElement.Image = e.Row.IsSelected ? Properties.Resources.EditPenWhite16 : Properties.Resources.EditPen16;
if (e.Column.Name == "Delete") // Delete
e.CellElement.Image = e.Row.IsSelected ? Properties.Resources.TrashcanWhite16 : Properties.Resources.Trashcan16;
if (e.Column.Name == "Relation")
{
if (e.CellElement.Value != "Maker")
e.Row.Cells["Delete"].Value = null;
}
}
}
Thanks
Carl