Entire row backcolor

I'm using a DataBoundGrid.
I'm trying to change the backcolor of an entire row based on the value in a single cell in that row.

I've tried something like this:
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (gridDataBoundGrid1[e.RowIndex, e.ColIndex].CellValueType == typeof (string))
{
if ((string) gridDataBoundGrid1[e.RowIndex, e.ColIndex].CellValue == "001")
{
GridRangeInfo range =
GridRangeInfo.Row(e.RowIndex);


GridStyleInfo style = new GridStyleInfo();
style.BackColor = Color.Red;

gridDataBoundGrid1.Model.ChangeCells(range, style, StyleModifyType.Override);

but it causes a stackoverflow when moving out of the cell and back, and doesn't change the backcolor of the row.

What would be the standard way to do something like this?

1 Reply

MW Miki Watts April 15, 2007 06:07 PM UTC

problem solved, thanks.

Loader.
Up arrow icon