GridView1.Columns.Count is always zero even SqlDataSource1.DataBind();
But Grid is ok
I can do
for (int i = 0; i < GridView1.HeaderRow.Cells.Count;i++)
I rename request headers here
but
GridView1.Columns[i].Visible = false;
I can’t use it because of GridView1.Columns.Count is 0.
So how can I hide them ?
Try putting the
e.Row.Cells[0].Visible = false;inside theRowCreatedevent of your grid.This way it auto-hides the whole column.
You don’t have access to the generated columns through
grid.Columns[i]in your gridview’sDataBoundevent.