The GridView has a RowDataBound event. This event gets fired for each row as it's being bound to the database. You can do an e.Item.FindControl() in this event to get a hold of the control in question, cast it to the type of the control, then enable or disable it. You can do this, of course, depending on whatever criteria you have.

You mentioned a button in the template controls, so you may have to handle the RowCommand event instead. This gets fired for the button (or any control) in any row in the GridView. You can still use e.Item.FindControl or e.FindControl and enable or disable it.