Hello,
I'm trying to format the Child Cells of a Hierarchical GridView via the CellFormatting event.
Here's the code I'm trying to use:
However, I'm finding that while the cellelement type sometimes is GridDetailViewCellElement, the columnindex is typically negative. In addition, I'm finding that the rowindex is out of range as well. Any help would be appreciated.
Thanks!
Jeremy
I'm trying to format the Child Cells of a Hierarchical GridView via the CellFormatting event.
Here's the code I'm trying to use:
private void grdRecord_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
if (e.CellElement is GridDetailViewCellElement) |
{ |
if (e.CellElement.ColumnIndex == (int)RecordScorpion.Column.Network) |
{ |
if (e.CellElement.Text.ToString().Contains("-")) |
{ |
grdRecord.Rows[e.CellElement.RowIndex].Cells[(int)Record.Column.Value].CellElement.ForeColor = Color.Blue; |
} |
else if (e.CellElement.Text.ToString() != string.Empty) |
{ |
grdRecord.Rows[e.CellElement.RowIndex].Cells[(int)Record.Column.Value].CellElement.ForeColor = Color.Purple; |
} |
} |
else if (e.CellElement.ColumnIndex == (int)RecordScorpion.Column.Item) |
{ |
e.CellElement.Text = ""; |
} |
} |
However, I'm finding that while the cellelement type sometimes is GridDetailViewCellElement, the columnindex is typically negative. In addition, I'm finding that the rowindex is out of range as well. Any help would be appreciated.
Thanks!
Jeremy