adding a confirm delete pop-up for a button field

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top