I have a condition on the page load of my page to disable a LinkButton and change the color of the letter. The Enabled attribute works but ForeColor does not, here's my code:
if (!Page.IsPostBack)
{
LlenarGridview(GridView1_Persona, Datos);
foreach (GridViewRow row in GridView1_Persona.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
if (row.Cells[2].Text == "Aprobado")
{
row.Cells[3].Enabled = false;
row.Cells[3].ForeColor=Color.Gray;
}else
{
row.Cells[3].ForeColor = Color.Green;
}
}
}
}