protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (GridViewRow gv in GridView1.Rows)
{
CheckBox kutuP = gv.FindControl("P") as CheckBox; //mevcut satirdaki
CheckBox kutuE = gv.FindControl("E") as CheckBox; //mevcut satirdaki
kutuE.Checked = false;
kutuP.Checked = false;
if (gv.RowType == DataControlRowType.DataRow)
{
if (gv.RowState != DataControlRowState.Edit)
{
try
{
if (gv.Cells[11].Text != "0" && gv.Cells[11].Text != "")
{
gv.Cells[11].BackColor = System.Drawing.Color.Orange;
gv.Cells[11].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[12].Text != "0" && gv.Cells[12].Text != "")
{
gv.Cells[12].BackColor = System.Drawing.Color.Orange;
gv.Cells[12].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[13].Text != "0" && gv.Cells[13].Text != "")
{
gv.Cells[13].BackColor = System.Drawing.Color.Orange;
gv.Cells[13].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[14].Text != "0" && gv.Cells[14].Text != "")
{
gv.Cells[14].BackColor = System.Drawing.Color.Orange;
gv.Cells[14].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[15].Text != "0" && gv.Cells[15].Text != "")
{
gv.Cells[15].BackColor = System.Drawing.Color.Orange;
gv.Cells[15].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[16].Text != "0" && gv.Cells[16].Text != "")
{
gv.Cells[16].BackColor = System.Drawing.Color.Orange;
gv.Cells[16].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[17].Text != "0" && gv.Cells[17].Text != "")
{
gv.Cells[17].BackColor = System.Drawing.Color.Orange;
gv.Cells[17].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[18].Text != "0" && gv.Cells[18].Text != "")
{
gv.Cells[18].BackColor = System.Drawing.Color.Orange;
gv.Cells[18].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[19].Text != "0" && gv.Cells[19].Text != "")
{
gv.Cells[19].BackColor = System.Drawing.Color.Orange;
gv.Cells[19].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[20].Text != "0" && gv.Cells[20].Text != "")
{
gv.Cells[20].BackColor = System.Drawing.Color.Orange;
gv.Cells[20].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[21].Text != "0" && gv.Cells[21].Text != "")
{
gv.Cells[21].BackColor = System.Drawing.Color.Orange;
gv.Cells[21].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[22].Text != "0" && gv.Cells[22].Text != "")
{
gv.Cells[22].BackColor = System.Drawing.Color.Orange;
gv.Cells[22].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[23].Text != "0" && gv.Cells[23].Text != "")
{
gv.Cells[23].BackColor = System.Drawing.Color.Orange;
gv.Cells[23].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[24].Text != "0" && gv.Cells[24].Text != "")
{
gv.Cells[24].BackColor = System.Drawing.Color.Orange;
gv.Cells[24].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[25].Text != "0" && gv.Cells[25].Text != "")
{
gv.Cells[25].BackColor = System.Drawing.Color.Orange;
gv.Cells[25].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[26].Text != "0" && gv.Cells[26].Text != "")
{
gv.Cells[26].BackColor = System.Drawing.Color.Orange;
gv.Cells[26].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[27].Text != "0" && gv.Cells[27].Text != "")
{
gv.Cells[27].BackColor = System.Drawing.Color.Orange;
gv.Cells[27].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[28].Text != "0" && gv.Cells[28].Text != "")
{
gv.Cells[28].BackColor = System.Drawing.Color.Orange;
gv.Cells[28].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[29].Text != "0" && gv.Cells[29].Text != "")
{
gv.Cells[29].BackColor = System.Drawing.Color.Orange;
gv.Cells[29].ForeColor = System.Drawing.Color.White;
kutuP.Checked = true;
}
if (gv.Cells[30].Text != "0" && gv.Cells[30].Text != "")
{
gv.Cells[30].BackColor = System.Drawing.Color.Orange;
gv.Cells[30].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[31].Text != "0" && gv.Cells[31].Text != "")
{
gv.Cells[31].BackColor = System.Drawing.Color.Orange;
gv.Cells[31].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[32].Text != "0" && gv.Cells[32].Text != "")
{
gv.Cells[32].BackColor = System.Drawing.Color.Orange;
gv.Cells[32].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[33].Text != "0" && gv.Cells[33].Text != "")
{
gv.Cells[33].BackColor = System.Drawing.Color.Orange;
gv.Cells[33].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
if (gv.Cells[34].Text != "0" && gv.Cells[34].Text != "")
{
gv.Cells[34].BackColor = System.Drawing.Color.Orange;
gv.Cells[34].ForeColor = System.Drawing.Color.White;
kutuE.Checked = true;
}
//*********************************************************
//else
//{
//gv.Cells[15].ForeColor = System.Drawing.Color.Black;
//gv.Cells[15].BackColor = System.Drawing.Color.Yellow;
//}
}
catch (Exception)
{
}
}
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Yellow'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='AliceBlue'");
}
}
}
0 Comments