Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

gridview cell color, c#

The existing code below, applies conditional format on a gridview (works fine). It applies shades to the entire row when it meets the criteria. This gridview has 3 columns in a row.

Question: How can I modify this code so that it will apply conditional format only to the last cell in a row?

Thank you.
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.CssClass = "highlightBracketground";
            var val = e.Row.Cells[2].Text;
            var snglVal = Single.Parse(val);
            e.Row.CssClass = snglVal > 0.0 ? "highlightBracketground" : "bracketground";
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Eghtebas

ASKER

Excellent, like always.