We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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.
Live Chat Icon For mobile
Up arrow icon