- In the RowCreated event for that datagrid put these codes below:
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(5).Attributes.CssStyle.Add(”display”, “none”)
End If - In the Databound event for the datagrid put these:
If GridLeaveDates.Rows.Count > 0 Then
GridLeaveDates.HeaderRow.Cells(5).Visible = False
End If
———————————————————————————
if (dg.Rows.Count > 0 )
{
dg.HeaderRow.Cells[2].Visible = false;
}