the buttons are part of the templates, you cannot do that, you should doButton btn = (Button)DataGrid1.Items[DataGrid1.EditItemIndex].FindControl("AddBtn");
btn.Visible = false;
....
btn.Visible = false;
....
你的这些Button是template的一部分,需要用老大的方法,先FindControl