May 9, 2014

How to change the color of a row of DevExpress ASPxGridView

Some times we need to paint the ranks of the DevExpress ASPxGridView grid. To do this we must implement the HtmlRowPrepared event, in this event we write our logic.

Below an example of how to implement the event HtmlRowPrepared


protected void listaRegistratos_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
        {
            try
            {
                if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
                string value = e.GetValue("STATUS").ToString();

                if (value == "Pendente")
                    e.Row.BackColor = System.Drawing.Color.PowderBlue;
                else if (value == "Ok")
                    e.Row.BackColor = System.Drawing.Color.MediumSeaGreen;
                else if (value == "Error")
                    e.Row.BackColor = System.Drawing.Color.Salmon;
                else if (value == "Em Processo")
                    e.Row.BackColor = System.Drawing.Color.RoyalBlue;
            }
            catch { }
        }

Ditulis Oleh : Angelo Hari: 12:13 PM Kategori:

0 comentarios:

Post a Comment