M
Mike P
How do you add a confirm delete pop-up for a button field? I've managed
to do this for a link button, where you can refer to the button id, but
there is no id to refer to for a button field. Here's my code :
<asp:ButtonField ButtonType="Image" ImageUrl="~/Images/btnDelete.jpg"
CommandName="Delete" />
and my code for the delete so far :
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
//// 1)Convert the row index stored in the CommandArgument property to
an Integer
int index = Convert.ToInt32(e.CommandArgument);
//// Retrieve the row that contains the button clicked by the user from
the Rows collection
GridViewRow row = GridView1.Rows[index];
////get datakeys
int intID = (int)GridView1.DataKeys[row.DataItemIndex].Value;
}
Thanks,
Mike
to do this for a link button, where you can refer to the button id, but
there is no id to refer to for a button field. Here's my code :
<asp:ButtonField ButtonType="Image" ImageUrl="~/Images/btnDelete.jpg"
CommandName="Delete" />
and my code for the delete so far :
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
//// 1)Convert the row index stored in the CommandArgument property to
an Integer
int index = Convert.ToInt32(e.CommandArgument);
//// Retrieve the row that contains the button clicked by the user from
the Rows collection
GridViewRow row = GridView1.Rows[index];
////get datakeys
int intID = (int)GridView1.DataKeys[row.DataItemIndex].Value;
}
Thanks,
Mike