Gridview’da satır içi değere bakıp farkı arka plan rengi verme olayı

Read Time:1 Minute, 15 Second

 protected void GrdFaaliyetler_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string al = e.Row.Cells[9].Text;
                if (!string.IsNullOrEmpty(al))
                {
                    if (al == “false” || al == “False”)
                        e.Row.BackColor = System.Drawing.Color.Red;
                }
            }
        }

Diğer satır özelliklerini değiştirmek için;

 if (e.RowType == GridViewRowType.Data)
        { 
            if (((ASPxGridView)sender).GetRowValues(e.VisibleIndex, “distFillStatus”).ToString() == “REJECTED”)
            {
                
                e.Row.BackColor = System.Drawing.Color.Red;
                e.Row.ForeColor = System.Drawing.Color.White;
                //e.Row.Font.Size = 15;
                //e.Row.Font.Bold = true;
                //e.Row.Attributes.Add(“style”, “background-color: red; fore-color: white;”);
            }
         }

About Post Author

Sayfa Yoneticisi

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Previous post asp.net iç içe if yapısı
Next post Gridview’da Update sırasında bazı sütun değerlerinin edit işlemine girmemesi olayı