creating pop-up box when deleting from datagrid

M

Mike P

Can anybody tell me what is wrong with this code? The main error I seem
to be getting is where I am creating the LinkButton called deleteButton.

public void dgLog_ItemDataBound(object sender, DataGridItemEventArgs e)
{
//First, make sure we're NOT dealing with a Header or Footer row
if (!(e.Item.ItemType == ListItemType.Header) && (!(e.Item.ItemType
== ListItemType.Footer)))
{
//Now, reference the LinkButton control that the Delete ButtonColumn
has been rendered to
LinkButton deleteButton = (LinkButton)e.Item.Cells[0].Controls[0];

//We can now add the onclick event handler
deleteButton.Attributes.Add("onClick", "javascript:return
confirm('Are you sure you want to delete DialledNum #" +
DataBinder.Eval(e.Item.DataItem,"DialledNum") + "?');");
}
}

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

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top