Allow me to share my approach for what it's worth. For me converting the commandfield to a templatefield control is not an option, as the commandfield comes with built-in functionality that I would otherwise have to create myself, for example the fact that it changes to "Update Cancel" when Edit is clicked, and that when Edit is clicked, all the cells in the row which are labels become textboxes, etc.
In my approach, you can leave the commandfield as is, then you can hide it as needed via code behind. In this example, I am hiding it if the field "Scenario" of the grid shows the text "Actual" for the relevant row of the RowDataBound event.
protected void gridDetail_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (((Label)e.Row.FindControl("lblScenario")).Text == "Actual")
{
LinkButton cmdField= (LinkButton)e.Row.Cells[0].Controls[0];
cmdField.Visible = false;
}
}}