Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
   Select Case e.Row.Cells(1).Text
            Case "禁用"
                e.Row.Cells(1).Text = "<font color=red>禁用</font>"
            Case "开启"    End Select
End Sub

解决方案 »

  1.   

    给你的GridView添加RowDataBound事件:protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if(e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.RowState == DataControlRowState.Alternate || e.Row.RowState == DataControlRowState.Normal)
                {
                    if (e.Row.Cells[1].Text == "开启")//Cells[1]表示第2列
                    {
                        e.Row.Cells[1].ForeColor = System.Drawing.Color.Black;
                    }
                    else
                    {
                        e.Row.Cells[1].ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
        }
      

  2.   

    for(int i=0;i<GridView2.Rows.Count-1;i++)
          {
            if (GridView2.Rows[i].Cells[1].Text== "杨过")
            {
                GridView2.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Black; 
            }
            else
            {
                GridView2.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Red; 
            }
          
         }
      

  3.   

        e.Row.Cells[1].ForeColor   =   System.Drawing.Color.Red; 
    楼上都说完了!