28 July 2014

How to set first row color to gridview in c#



protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      try
       {
                if (e.Row.RowIndex == 0)
                {
                    e.Row.BackColor = System.Drawing.Color.YellowGreen;

                }
       }
       catch (Exception ex)
       {
          lbl_error.Visible = true;
          lbl_error.ForeColor = System.Drawing.Color.Red;
          lbl_error.Text = ex.Message;
              
       }

  }

8 July 2014