Confirmation of delete

  • Thread starter Thread starter Angela
  • Start date Start date
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
 
Back
Top