如何在gridview中改变单个单元格的颜色..?

时间:2013-11-13 08:08:41

标签: datagridview

如何在gridview中改变单个单元格的颜色..?

protected void gv_transaction_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells[6].Text == "Cancelled")
            {
                e.Row.Cells[6].ForeColor = System.Drawing.Color.Red;
            }
        }

1 个答案:

答案 0 :(得分:0)

e.Row.Cells[6].Style.ForeColor = Color.Red;