Just add the RowDataBound Event to GridView. and palce the specified code inside.
<asp:gridview id="GridView1" runat="server" allowpaging="True" autogeneratecolumns="False" xmlns:asp="#unknown">
DataKeyNames="ID" DataSourceID="SqlDataSource1" PageSize="15" AllowSorting="True" OnRowDatabound="GridView1_RowDataBound" OnRowCommand = "GridView1_RowCommand" >
protected void GridView1_RowDataBound(object sender, GridViewRowCommandEventArgs e)
{
if(e.Row.RowIndex != -1)
{
LinkButton btn = (LinkButton)e.Row.Cells[1].Controls[1];
btn.Attributes.Add("onclick","if (confirm('Are you sure to delete this admin user?')){return true} else {return false}");
}
}
</asp:gridview>
this code is working in my sample gridview..