btnDelete.Attributes.Add("onClick","return confirm('Do you want to delete "+e.Row.DataItem.ToString() + "?' );");Not tested however.
>protected void grdDeleteUsers_RowDataBound(object sender, GridViewRowEventArgs e) > { > if (e.Row.DataItem != null) > { > ImageButton btnDelete = (ImageButton) e.Row.Cells[0].Controls[0]; > > //((ImageButton)item.Cells[0].Controls[0]).Attributes.Add("onClick", "return confirm('Are you sure you want to delete this ?')"); > > //LinkButton link = e.Row.FindControl("lnkbtnRemoveRole") as LinkButton; > > if (btnDelete != null) > { > > e.Row.ToolTip = "Delete " + e.Row.DataItem.ToString() ; > > //btnDelete.Attributes["onclick"] = > // "return confirm('Do you want to delete " + > // e.Row.DataItem.ToString() + "?' );"; > // btnDelete.CommandArgument = "RemUser"; > } > } > }>