Skip header row of GridView

Most of the time, we need to find controls under at RowDataBound event of GridView control to do some important functionality.
For example, Show/Hide the control, change the color of the control, bind some javascript function with the control etc.

So below is the code to skip the header in the RowDataBound event of GridView

if (e.Row.RowType == DataControlRowType.DataRow)
{
      CheckBox chkBox = (CheckBox)e.Row.FindControl("checkbox1");
      chkBox.BackColor = System.Drawing.Color.Red;
}
Ebook Download
View all
Learn
View all