Are you asking if you can turn autogenerateeditbutton on/off based on some value? If so, you need to undertand the change will affect the whole gridview, not certain rows only
if the grid has
<asp:detailsview autogenerateeditbutton="True|False" xmlns:asp="#unknown" />
defined then remove it, then call
gridvie.AutoGenerateEditButton()
, preferably on your PageLoad() method
See here for more
details[
^]