6
Reply

ASP.NET GridView RowDataBound Event

Bineesh  VP

Bineesh VP

Aug 20 2013 12:57 AM
7.8k
Sir, I want your help in the GridView RowDataBound Event in ASP.NET.

Let's see the gridView:-



I likes to have   BackColor  to the column- SELECT and DELETE.

I just tried a coding for this. Here the code

 protected void dgvMovie_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[4].Text == "Select")
                {
                    e.Row.BackColor = System.Drawing.Color.LightBlue;
                }


                if (e.Row.Cells[5].Text == "Delete")
                {
                    e.Row.BackColor = System.Drawing.Color.LightBlue;
                }
            }
           
        }

So If the code have logical error, please rectify it.

Answers (6)