When you have an asp.net gridview (framework 3.5) on your page, which includes a column of "asp:CommandField" there is no option to control any client-side behaviour with the designer. I wanted a client side confirmation when a user pressed the delete icon which I placed by asp:CommandField ButtonType="Image" DeleteImageUrl="~/images/del.png" ...
protected void grdItems_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.Cells.Count > 1)
var ctls = e.Row.Cells[e.Row.Cells.Count - 1].Controls;
foreach (var c in ctls)
if ((c is ImageButton)
&& (((ImageButton)c).CommandName == "Delete"))
"if (!window.confirm('Are you sure')) return false;";