Confirmation of delete

A

Angela

Hi,

Can't seem to find the answer to this on any posts.

I want the javascript confirmation of delete to occur on my datalist for
the 'delete' linkbutton. The code below works fine for the delete, but
it somehow gets fired off when 'edit' linkbutton is clicked on. Which i
don't understand.


I have the following code:

Private Sub dlstAddress_ItemCreated(ByVal s As Object, ByVal e As
DataListItemEventArgs) Handles dlstAddress.ItemCreated

If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <>
ListItemType.Footer Then

Dim linkDelete As LinkButton =
CType(e.Item.FindControl("LinkDelete"), LinkButton)

linkDelete.Attributes.Add("onclick", "return confirm('Are
you sure you want to delete selected item?');")
End If

End Sub


Thanks in advance
 

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

Top